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
if not skip then STRING_TEXT (LexCont.String(args.ifdefStack, args.stringNest, LexerStringStyle.TripleQuote, LexerStringKind.InterpolatedStringFirst, m))
@@ -628,9 +624,7 @@ rule token args skip = parse
628
624
// Single quote in triple quote ok, others disallowed
if not skip then STRING_TEXT (LexCont.String(args.ifdefStack, args.stringNest, LexerStringStyle.SingleQuote, LexerStringKind.InterpolatedStringFirst, m))
@@ -641,9 +635,7 @@ rule token args skip = parse
641
635
642
636
// Single quote in triple quote ok, others disallowed
Copy file name to clipboardExpand all lines: tests/fsharp/Compiler/Language/StringInterpolation.fs
+63-72
Original file line number
Diff line number
Diff line change
@@ -730,50 +730,70 @@ let x3 : FormattableString = $"one %10s{String.Empty}" // no %10s in Formattable
730
730
(FSharpDiagnosticSeverity.Error,3376,(6,30,6,55),
731
731
"Invalid interpolated string. Interpolated strings used as type IFormattable or type FormattableString may not use '%' specifiers, only .NET-style interpolands such as '{expr}', '{expr,3}' or '{expr:N5}' may be used.")|]
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. \
751
-
Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
753
+
(FSharpDiagnosticSeverity.Error,3373,(5,24,5,26),
754
+
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
755
+
(FSharpDiagnosticSeverity.Error,3373,(6,24,6,26),
756
+
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
757
+
(FSharpDiagnosticSeverity.Error,3373,(7,25,7,26),
758
+
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
759
+
(FSharpDiagnosticSeverity.Error,3373,(8,25,8,26),
760
+
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
761
+
(FSharpDiagnosticSeverity.Error,3373,(9,25,9,27),
762
+
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.")|]
769
+
770
+
[<Test>]
771
+
let``String interpolation negative nested in triple`` ()=
772
+
letcode="
773
+
774
+
open System
775
+
let TripleInTripleInterpolated = $\"\"\"123{456}789{\"\"\"012\"\"\"}345\"\"\"
776
+
let TripleInSingleInterpolated = $\"123{456}789{\"\"\"012\"\"\"}345\"
777
+
let TripleInVerbatimInterpolated = $\"123{456}789{\"\"\"012\"\"\"}345\"
778
+
let TripleInterpolatedInTripleInterpolated = $\"\"\"123{456}789{$\"\"\"012\"\"\"}345\"\"\"
779
+
let TripleInterpolatedInSingleInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}345\"
780
+
let TripleInterpolatedInVerbatimInterpolated = $\"123{456}789{$\"\"\"012\"\"\"}345\"
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.");
"End of file in triple-quote string begun at or before here")|]
776
-
786
+
(FSharpDiagnosticSeverity.Error,3374,(5,50,5,53),
787
+
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.");
788
+
(FSharpDiagnosticSeverity.Error,3374,(6,50,6,53),
789
+
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.");
790
+
(FSharpDiagnosticSeverity.Error,3374,(7,64,7,68),
791
+
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.");
792
+
(FSharpDiagnosticSeverity.Error,3374,(8,62,8,66),
793
+
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.");
794
+
(FSharpDiagnosticSeverity.Error,3374,(9,62,9,66),
795
+
"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression.")|]
@@ -783,46 +803,17 @@ let x3 : FormattableString = $"one %10s{String.Empty}" // no %10s in Formattable
783
803
"Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token.");
784
804
(FSharpDiagnosticSeverity.Error,3379,(1,38,1,39),
785
805
"Incomplete interpolated string begun at or before here")|]
786
-
806
+
787
807
[<Test>]
788
-
let``String interpolation negative incomplete string with incomplete fill`` ()=
"Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token.");
794
814
(FSharpDiagnosticSeverity.Error,3378,(1,18,1,19),
795
815
"Incomplete interpolated string expression fill begun at or before here")|]
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. \
804
-
Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
805
-
(FSharpDiagnosticSeverity.Error,10,(1,1,1,39),
806
-
"Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token.");
807
-
(FSharpDiagnosticSeverity.Error,514,(1,38,1,39),
808
-
"End of file in string begun at or before here")|]
809
-
810
-
[<Test>]
811
-
let``String interpolation negative incomplete fill with another valid string`` ()=
"Invalid interpolated string. Single quote or verbatim string literals may not be used in interpolated expressions in single quote or verbatim strings. \
820
-
Consider using an explicit 'let' binding for the interpolation expression or use a triple quote string as the outer string literal.");
821
-
(FSharpDiagnosticSeverity.Error,10,(4,1,4,1),
822
-
"Incomplete structured construct at or before this point in binding. Expected interpolated string (final part), interpolated string (part) or other token.");
823
-
(FSharpDiagnosticSeverity.Error,514,(3,25,3,26),
824
-
"End of file in string begun at or before here")|]
0 commit comments