You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| [{ Type = ILType.Array(shape, ty) }] -> shape = ILArrayShape.SingleDimensional && isILObjectTy ty
562
+
| _ -> false
563
+
| _ -> false
564
+
)
565
+
{ StringConcatMethod = concat }
566
+
567
+
546
568
{ g = g
547
569
amap = amap
548
570
recUses = ValMultiMap<_>.Empty
@@ -558,7 +580,9 @@ type cenv =
558
580
isSig = isSig
559
581
haveSig = haveSig
560
582
compilingCanonicalFslibModuleType = (isSig || not haveSig) && g.compilingFslib
561
-
conditionalDefines = conditionalDefines }
583
+
conditionalDefines = conditionalDefines
584
+
stringFormatEnv = stringFormatEnv
585
+
exprParser = exprParser }
562
586
563
587
let CopyAndFixupTypars m rigid tpsorig =
564
588
ConstraintSolver.FreshenAndFixupTypars m rigid [] [] tpsorig
@@ -6531,7 +6555,7 @@ and TcConstStringExpr cenv overallTy env m tpenv s =
6531
6555
let source = match cenv.tcSink.CurrentSink with None -> None | Some sink -> sink.CurrentSource
6532
6556
let normalizedString = (s.Replace("\r\n", "\n").Replace("\r", "\n"))
6533
6557
6534
-
let (aty',ety'), specifierLocations = (try CheckFormatStrings.ParseFormatString m cenv.g source normalizedString bty cty dty with Failure s -> error (Error(FSComp.SR.tcUnableToParseFormatString(s),m)))
6558
+
let fragments, (aty',ety'), specifierLocations = (try CheckFormatStrings.ParseFormatString m cenv.g source normalizedString bty cty dty with Failure s -> error (Error(FSComp.SR.tcUnableToParseFormatString(s),m)))
6535
6559
6536
6560
match cenv.tcSink.CurrentSink with
6537
6561
| None -> ()
@@ -6541,7 +6565,27 @@ and TcConstStringExpr cenv overallTy env m tpenv s =
6541
6565
6542
6566
UnifyTypes cenv env m aty aty'
6543
6567
UnifyTypes cenv env m ety ety'
6544
-
mkCallNewFormat cenv.g m aty bty cty dty ety (mkString cenv.g m s),tpenv
6568
+
let tpenv, formatString =
6569
+
let tpenv, stringFragments =
6570
+
((tpenv, []), fragments) ||> List.fold (fun (currentTpEnv, l) v ->
6571
+
match v with
6572
+
| CheckFormatStrings.FormatStringFragment.Text s -> currentTpEnv, ((mkString cenv.g m s)::l)
6573
+
| CheckFormatStrings.FormatStringFragment.Expr s ->
6574
+
let synExpr = cenv.exprParser s
6575
+
let expr, _ty, tpenv1 = TcExprOfUnknownType cenv env tpenv synExpr
6576
+
tpenv1, expr::l
6577
+
//mkString cenv.g m s // TODO
6578
+
)
6579
+
let stringFragments = List.rev stringFragments
6580
+
match stringFragments with
6581
+
| [s] -> tpenv, s
6582
+
| x ->
6583
+
let coersed = x |> List.map (fun s -> mkCoerceIfNeeded cenv.g cenv.g.obj_ty cenv.g.string_ty s)
6584
+
let arr = Expr.Op(TOp.Array, [cenv.g.obj_ty], coersed, m)
0 commit comments