Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC FS-1001] String Interpolation #8907

Merged
merged 195 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
1ba6b74
string interploation implementation
dsyme Apr 9, 2020
23d38cc
string interploation tests
dsyme Apr 15, 2020
2593c76
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Apr 15, 2020
cf658de
escape {{ }}, test verbatim and triple quote, implement .NET specifiers
dsyme Apr 15, 2020
6a9128b
fix tests
dsyme Apr 15, 2020
047fda6
string interpolation tests: internal representation corner cases
Apr 16, 2020
b31c14f
string-interp tests should have --langversion:preview
Apr 16, 2020
484e46c
string interop tests: sprintf
Apr 16, 2020
d475013
string interp tests: format specifier negative cases
Apr 16, 2020
e1f416f
string interp tests: format specifier negative cases, .NET-style padding
Apr 16, 2020
465594f
Merge pull request #8959 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 17, 2020
e0c50e8
Merge pull request #8979 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 17, 2020
d23441e
Merge pull request #8992 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 18, 2020
bc1b156
Merge branch 'feature/string-interp' of http://github.com/dotnet/fsha…
Apr 18, 2020
b17c3ed
fix nested interp strings
Apr 18, 2020
e5d3a2c
style cleanup
Apr 19, 2020
1072e51
lex: unify string interp stack and counter
Apr 19, 2020
3c19e22
string-interp: add test cases
Apr 19, 2020
ddaf4b2
fix mixed quote nested string interpolation
Apr 19, 2020
7677c99
string-interp: add test case for multiple interpolation points with d…
Apr 19, 2020
7a4d707
lexfilter: push new CtxtParen at endPos for INTERP_STRING_PART and IN…
Apr 19, 2020
6f6a6b3
lexfilter: do not check undentation limit for string interpolation to…
Apr 19, 2020
8207035
Merge pull request #9003 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 20, 2020
357d92c
Merge pull request #8997 from yatli/feature/string-interp-nested
dsyme Apr 20, 2020
4cb847f
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Apr 20, 2020
f36d255
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme Apr 20, 2020
2b242db
FormattableString prototype
dsyme Apr 21, 2020
1e2b377
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Apr 22, 2020
69ae733
add FormattableString support
dsyme Apr 22, 2020
d7388cc
negative error checking
dsyme Apr 22, 2020
b2d1cc9
remove diagnostics
dsyme Apr 22, 2020
ad2e050
simpler FormattableString implementation
dsyme Apr 23, 2020
279c05d
fix test
dsyme Apr 23, 2020
500ecf7
add testing for nested
dsyme Apr 23, 2020
9bf95ab
add IFormattable support
dsyme Apr 23, 2020
47b61ec
tweak error message
dsyme Apr 23, 2020
7306572
Merge remote-tracking branch 'upstream/feature/string-interp' into fe…
Apr 24, 2020
455b568
tests: StringInterpolation: fix case errors
Apr 24, 2020
7b79c98
fix error message
dsyme Apr 24, 2020
ca838cb
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Apr 24, 2020
39070da
check number of values matches
dsyme Apr 24, 2020
842ae0a
Merge remote-tracking branch 'upstream/feature/string-interp' into fe…
Apr 24, 2020
5f0e16d
Merge pull request #9045 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 25, 2020
dcab1d6
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Apr 27, 2020
50c7d70
Merge pull request #9058 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 27, 2020
45501bf
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom Apr 29, 2020
85e8b16
Merge pull request #9074 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 30, 2020
bd9ccf9
Merge pull request #9084 from dotnet/merges/master-to-feature/string-…
KevinRansom Apr 30, 2020
d12456b
Merge pull request #9090 from dotnet/merges/master-to-feature/string-…
KevinRansom May 1, 2020
373ccf3
allow use of format strings with printf and friends
dsyme May 1, 2020
eb30ac3
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme May 1, 2020
f9684c9
update baselines
dsyme May 1, 2020
8e10cd9
fix baselines
dsyme May 1, 2020
6d9a1ac
add Experimental attributes
dsyme May 1, 2020
49eb291
update string interp negative tests
May 2, 2020
086c0d9
Merge remote-tracking branch 'upstream/feature/string-interp' into fe…
May 2, 2020
49ba592
stringinterp test: add PrintFormat tests
May 2, 2020
7f39617
printf: fix empty interpolation string evaluates to null in printf env
May 2, 2020
5f01922
enable test corectly
dsyme May 4, 2020
66a1c35
Revert "printf: fix empty interpolation string evaluates to null in p…
May 4, 2020
3ddb5f4
Merge pull request #8966 from yatli/feature/string-interp
dsyme May 4, 2020
ba0e2ce
simplify codegen for interpolated strings
dsyme May 4, 2020
b3b9438
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme May 4, 2020
21f4c7a
Merge pull request #9098 from dotnet/merges/master-to-feature/string-…
KevinRansom May 4, 2020
7d66fa8
Merge pull request #9131 from dotnet/merges/master-to-feature/string-…
KevinRansom May 5, 2020
901bf8e
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme May 5, 2020
c47df89
Merge pull request #9160 from dotnet/merges/master-to-feature/string-…
KevinRansom May 11, 2020
dde09f8
Merge pull request #9173 from dotnet/merges/master-to-feature/string-…
KevinRansom May 13, 2020
40f863e
Merge pull request #9182 from dotnet/merges/master-to-feature/string-…
KevinRansom May 14, 2020
c3039cc
Merge pull request #9191 from dotnet/merges/master-to-feature/string-…
KevinRansom May 14, 2020
3945571
Merge pull request #9196 from dotnet/merges/master-to-feature/string-…
KevinRansom May 15, 2020
49da374
Merge pull request #9204 from dotnet/merges/master-to-feature/string-…
KevinRansom May 16, 2020
bc755cb
Merge pull request #9210 from dotnet/merges/master-to-feature/string-…
KevinRansom May 16, 2020
3cdec16
Merge pull request #9214 from dotnet/merges/master-to-feature/string-…
KevinRansom May 17, 2020
01be506
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom May 20, 2020
f42cbce
Merge branch 'master' into feature/string-interp
dsyme May 21, 2020
24b3ad6
Merge pull request #9239 from dotnet/merges/master-to-feature/string-…
KevinRansom May 23, 2020
bfbd6af
Merge pull request #9278 from dotnet/merges/master-to-feature/string-…
KevinRansom May 24, 2020
ab229df
Merge pull request #9288 from dotnet/merges/master-to-feature/string-…
KevinRansom May 25, 2020
980e0d3
Merge pull request #9307 from dotnet/merges/master-to-feature/string-…
KevinRansom May 26, 2020
8158ca9
Merge pull request #9312 from dotnet/merges/master-to-feature/string-…
KevinRansom May 27, 2020
bb9695b
Merge pull request #9321 from dotnet/merges/master-to-feature/string-…
KevinRansom May 28, 2020
6f1e6ed
Merge pull request #9327 from dotnet/merges/master-to-feature/string-…
KevinRansom May 28, 2020
553e62a
Merge pull request #9332 from dotnet/merges/master-to-feature/string-…
KevinRansom May 29, 2020
8455ce6
Merge pull request #9345 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 1, 2020
5a5fd03
Merge pull request #9354 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 1, 2020
58a71a5
integrate master
dsyme Jun 3, 2020
bf29c6e
fix build
dsyme Jun 3, 2020
ea9b483
Merge pull request #9441 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 13, 2020
a4957c7
Merge pull request #9453 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 16, 2020
ccc186b
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Jun 16, 2020
909e8b9
Merge pull request #9467 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 17, 2020
fe5f2a2
fix build
dsyme Jun 17, 2020
1f463ad
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme Jun 17, 2020
f170f5c
Merge pull request #9478 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 17, 2020
ec9b805
Merge pull request #9488 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 18, 2020
093f3d0
Merge pull request #9494 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 18, 2020
82c16b2
Merge pull request #9505 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 19, 2020
b66c67b
Merge pull request #9530 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 22, 2020
517f5d4
Merge pull request #9537 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 23, 2020
34291d3
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom Jun 23, 2020
c3f40ff
Merge branch 'master' into feature/string-interp
KevinRansom Jun 23, 2020
6ad30ef
Merge pull request #9545 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 23, 2020
72c1b81
Merge pull request #9551 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 24, 2020
9496c75
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom Jun 24, 2020
e3f0266
Merge pull request #9560 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 25, 2020
0bcce18
Merge pull request #9564 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 25, 2020
926651b
Merge pull request #9569 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 26, 2020
098ae6c
Merge pull request #9573 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 26, 2020
e04ac6d
Merge master to feature/string-interp (#9580)
dotnet-bot Jun 27, 2020
7835fb4
Merge pull request #9585 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 28, 2020
0bfde32
Re enable tests for operators: OperatorsModule1.fs and OperatorsModul…
dotnet-bot Jun 29, 2020
99d8356
Merge pull request #9592 from dotnet/merges/master-to-feature/string-…
KevinRansom Jun 29, 2020
504d537
Moved fsharpqa/Libraries/Core/Unchecked test cases to NUnit (#9576) (…
dotnet-bot Jun 30, 2020
edd276c
Moved fsharpqa/Libraries/Core/Unchecked test cases to NUnit (#9576) (…
dotnet-bot Jul 3, 2020
5e3a85c
Merge master to feature/string-interp (#9615)
dotnet-bot Jul 3, 2020
9731382
Merge master to feature/string-interp (#9619)
dotnet-bot Jul 4, 2020
1c9852f
Merge pull request #9624 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 6, 2020
92b619e
merge
KevinRansom Jul 7, 2020
068198f
Text tweeks
KevinRansom Jul 7, 2020
ad81cdc
Merge pull request #9636 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 8, 2020
7108b5b
don't auto-resolve types from System.Runtime.WindowsRuntime (#9644) (…
dotnet-bot Jul 8, 2020
85eb5ee
Merge pull request #9651 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 9, 2020
c032ce1
yeet (#9657) (#9661)
dotnet-bot Jul 10, 2020
da3cba5
yeet (#9657) (#9670)
dotnet-bot Jul 10, 2020
60ec1cc
Merge pull request #9676 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 11, 2020
15c39f5
Merge pull request #9681 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 11, 2020
ffb29a9
Merge pull request #9689 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 14, 2020
241204e
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Jul 15, 2020
597c654
Merge pull request #9700 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 15, 2020
d1b2cb0
Merge pull request #9709 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 20, 2020
be2bb89
Merge pull request #9725 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 21, 2020
8433a0c
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom Jul 21, 2020
7990667
Merge pull request #9731 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 22, 2020
aed1db7
auto merge
dsyme Jul 22, 2020
cb608ae
fix up tokenizer tests
dsyme Jul 22, 2020
11b719f
integrate
dsyme Jul 22, 2020
d98ae40
fix code review things
dsyme Jul 22, 2020
fa821ab
fix code review things
dsyme Jul 22, 2020
9db99f9
fix code review things
dsyme Jul 22, 2020
a4fee1d
fix code review things
dsyme Jul 22, 2020
e2f80b3
add various testing
dsyme Jul 22, 2020
0f61536
correct continuations for interpolated strings
dsyme Jul 23, 2020
fbde331
fix lexer continuations and colorization for multi-line interpolated …
dsyme Jul 23, 2020
c65203f
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Jul 23, 2020
b6a2ede
revert xlf changes
dsyme Jul 23, 2020
110876d
fix assert
dsyme Jul 23, 2020
e7cdb8b
Merge branch 'master' of https://github.com/dotnet/fsharp into featur…
dsyme Jul 23, 2020
07394d3
completion and brace matching (not all tests passing yet)
dsyme Jul 23, 2020
458a5e6
Fix rebuild
KevinRansom Jul 24, 2020
cf2d420
Merge branch 'FixBuild' of https://github.com/KevinRansom/fsharp into…
dsyme Jul 24, 2020
646fc94
fix various niggles and get tests working
dsyme Jul 24, 2020
32da3a1
fix printf when '%a' in final position
dsyme Jul 24, 2020
6514788
fix test case
dsyme Jul 24, 2020
e758b4b
interpolated string specifer highlighting
dsyme Jul 24, 2020
5fba578
fix triple quote interpolated string specifer highlighting
dsyme Jul 24, 2020
56f3632
fix triple quote interpolated string specifer highlighting
dsyme Jul 24, 2020
68df7db
fix build
dsyme Jul 24, 2020
f53a18b
fix missing error message
dsyme Jul 24, 2020
f726bb5
Merge pull request #9775 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 25, 2020
e3d1a74
fix % specifiers for interpolated strings
dsyme Jul 25, 2020
4b898cf
fix % specifiers for interpolated strings
dsyme Jul 25, 2020
fbb3251
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme Jul 25, 2020
22535de
fix FCS tests
dsyme Jul 25, 2020
25b9662
Merge pull request #9783 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 25, 2020
90e7ac7
Merge pull request #9791 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 25, 2020
9668a67
Merge pull request #9794 from dotnet/merges/master-to-feature/string-…
cartermp Jul 26, 2020
f32e77f
minor nits from code review
dsyme Jul 27, 2020
c2430dc
Merge branch 'feature/string-interp' of https://github.com/dotnet/fsh…
dsyme Jul 27, 2020
b0c012f
Merge pull request #9804 from dotnet/merges/master-to-feature/string-…
cartermp Jul 27, 2020
51dd50f
Merge pull request #9811 from dotnet/merges/master-to-feature/string-…
cartermp Jul 28, 2020
f002be9
code review feedback and use struct tuples in more places
dsyme Jul 28, 2020
6e99014
revert struct tuples
dsyme Jul 28, 2020
e864cc7
use struct tuples where possible, byrefs for index
dsyme Jul 28, 2020
f834f7e
fix byref for index
dsyme Jul 28, 2020
bda29f6
fix ksprintf block size
dsyme Jul 28, 2020
cbd33aa
make recent cache entry more explicit (cleanup)
dsyme Jul 28, 2020
b827b10
improve performance
dsyme Jul 29, 2020
f2832d3
remove unused code
dsyme Jul 29, 2020
4e51a9b
Merge pull request #9819 from dotnet/merges/master-to-feature/string-…
cartermp Jul 29, 2020
a811af3
Merge pull request #9822 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 29, 2020
071f075
Merge pull request #9832 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 29, 2020
d9ba442
Merge branch 'feature/string-interp' into merges/master-to-feature/st…
KevinRansom Jul 30, 2020
aaf7faa
Merge pull request #9835 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 30, 2020
d8bb2ff
Merge pull request #9843 from dotnet/merges/master-to-feature/string-…
KevinRansom Jul 31, 2020
bc6ea74
Move existing Compiler.ComponentTests to a new Compiler.fs framework …
dotnet-bot Jul 31, 2020
0a88a66
Move existing Compiler.ComponentTests to a new Compiler.fs framework …
vzarytovskii Jul 30, 2020
b6fbc74
Merge pull request #9851 from dotnet/merges/master-to-feature/string-…
KevinRansom Aug 1, 2020
93a1a0d
Merge pull request #9856 from dotnet/merges/master-to-feature/string-…
KevinRansom Aug 2, 2020
6af4caf
Merge branch 'master' into feature/string-interp
dsyme Aug 5, 2020
3a4066c
Merge pull request #9884 from dotnet/merges/master-to-feature/string-…
KevinRansom Aug 6, 2020
d27379f
Merge pull request #9889 from dotnet/merges/master-to-feature/string-…
cartermp Aug 6, 2020
83e63a6
merge
KevinRansom Aug 6, 2020
60db04e
fix https://github.com/dotnet/fsharp/issues/9893
dsyme Aug 7, 2020
ba48b59
fix unmantched right brace in interp string
dsyme Aug 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 273 additions & 90 deletions src/fsharp/CheckFormatStrings.fs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/fsharp/CheckFormatStrings.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ module internal FSharp.Compiler.CheckFormatStrings

open FSharp.Compiler
open FSharp.Compiler.NameResolution
open FSharp.Compiler.Range
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TcGlobals

val ParseFormatString : Range.range -> TcGlobals -> formatStringCheckContext: FormatStringCheckContext option -> fmt: string -> bty: TType -> cty: TType -> dty: TType -> (TType * TType) * (Range.range * int) list
val ParseFormatString : m: range -> fragmentRanges: range list -> g: TcGlobals -> isInterpolated: bool -> isFormattableString: bool -> formatStringCheckContext: FormatStringCheckContext option -> fmt: string -> bty: TType -> cty: TType -> dty: TType -> TType list * TType * TType * TType[] * (range * int) list * string

val TryCountFormatStringArguments : m:Range.range -> g:TcGlobals -> fmt:string -> bty:TType -> cty:TType -> int option
val TryCountFormatStringArguments: m: range -> g: TcGlobals -> isInterpolated: bool -> fmt:string -> bty:TType -> cty:TType -> int option
10 changes: 7 additions & 3 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa
| Parser.TOKEN_EOF -> getErrorString("Parser.TOKEN.EOF")
| Parser.TOKEN_CONST -> getErrorString("Parser.TOKEN.CONST")
| Parser.TOKEN_FIXED -> getErrorString("Parser.TOKEN.FIXED")
| Parser.TOKEN_INTERP_STRING_BEGIN_END -> getErrorString("Parser.TOKEN.INTERP.STRING.BEGIN.END")
| Parser.TOKEN_INTERP_STRING_BEGIN_PART -> getErrorString("Parser.TOKEN.INTERP.STRING.BEGIN.PART")
| Parser.TOKEN_INTERP_STRING_PART -> getErrorString("Parser.TOKEN.INTERP.STRING.PART")
| Parser.TOKEN_INTERP_STRING_END -> getErrorString("Parser.TOKEN.INTERP.STRING.END")
| unknown ->
Debug.Assert(false, "unknown token tag")
let result = sprintf "%+A" unknown
Expand Down Expand Up @@ -3588,13 +3592,13 @@ let ParseOneInputLexbuf (tcConfig: TcConfig, lexResourceManager, conditionalComp
use unwindbuildphase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse
try
let skip = true in (* don't report whitespace from lexer *)
let lightSyntaxStatus = LightSyntaxStatus (tcConfig.ComputeLightSyntaxInitialStatus filename, true)
let lexargs = mkLexargs (filename, conditionalCompilationDefines@tcConfig.conditionalCompilationDefines, lightSyntaxStatus, lexResourceManager, [], errorLogger, tcConfig.pathMap)
let lightStatus = LightSyntaxStatus (tcConfig.ComputeLightSyntaxInitialStatus filename, true)
let lexargs = mkLexargs (conditionalCompilationDefines@tcConfig.conditionalCompilationDefines, lightStatus, lexResourceManager, [], errorLogger, tcConfig.pathMap)
let shortFilename = SanitizeFileName filename tcConfig.implicitIncludeDir
let input =
Lexhelp.usingLexbufForParsing (lexbuf, filename) (fun lexbuf ->
if verbose then dprintn ("Parsing... "+shortFilename)
let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf)
let tokenizer = LexFilter.LexFilter(lightStatus, tcConfig.compilingFslib, Lexer.token lexargs skip, lexbuf)

if tcConfig.tokenizeOnly then
while true do
Expand Down
7 changes: 6 additions & 1 deletion src/fsharp/ErrorLogger.fs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -702,4 +702,9 @@ let internal tryLanguageFeatureErrorRecover langVersion langFeature m =
| None -> ()

let internal tryLanguageFeatureErrorOption langVersion langFeature m =
tryLanguageFeatureErrorAux langVersion langFeature m
tryLanguageFeatureErrorAux langVersion langFeature m

let internal languageFeatureNotSupportedInLibraryError (langVersion: LanguageVersion) (langFeature: LanguageFeature) (m: range) =
let featureStr = langVersion.GetFeatureString langFeature
let suggestedVersionStr = langVersion.GetFeatureVersionString langFeature
error (Error(FSComp.SR.chkFeatureNotSupportedInLibrary(featureStr, suggestedVersionStr), m))
17 changes: 17 additions & 0 deletions src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,7 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
3350,chkFeatureNotLanguageSupported,"Feature '%s' is not available in F# %s. Please use language version %s or greater."
3351,chkFeatureNotRuntimeSupported,"Feature '%s' is not supported by target runtime."
3352,typrelInterfaceMemberNoMostSpecificImplementation,"Interface member '%s' does not have a most specific implementation."
3353,chkFeatureNotSupportedInLibrary,"Feature '%s' requires the F# library for language version %s or greater."
useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)."
optsLangVersion,"Display the allowed values for language version, specify language version such as 'latest' or 'preview'"
optsSupportedLangVersions,"Supported language versions:"
Expand All @@ -1509,11 +1510,27 @@ featureFixedIndexSlice3d4d,"fixed-index slice 3d/4d"
featureAndBang,"applicative computation expressions"
featureNullableOptionalInterop,"nullable optional interop"
featureDefaultInterfaceMemberConsumption,"default interface member consumption"
featureStringInterpolation,"string interpolation"
featureWitnessPassing,"witness passing for trait constraints in F# quotations"
3353,fsiInvalidDirective,"Invalid directive '#%s %s'"
3360,typrelInterfaceWithConcreteAndVariable,"'%s' cannot implement the interface '%s' with the two instantiations '%s' and '%s' because they may unify."
3361,typrelInterfaceWithConcreteAndVariableObjectExpression,"You cannot implement the interface '%s' with the two instantiations '%s' and '%s' because they may unify."
featureInterfacesWithMultipleGenericInstantiation,"interfaces with multiple generic instantiation"
3362,tcLiteralFieldAssignmentWithArg,"Cannot assign '%s' to a value marked literal"
3363,tcLiteralFieldAssignmentNoArg,"Cannot assign a value to another value marked literal"
forFormatInvalidForInterpolated,"Interpolated strings may not use '%%' format specifiers unless each is given an expression, e.g. '%%d{{1+1}}'."
forFormatInvalidForInterpolated2,".NET-style format specifiers such as '{{x,3}}' or '{{x:N5}}' may not be mixed with '%%' format specifiers."
forFormatInvalidForInterpolated3,"The '%%P' specifier may not be used explicitly."
forFormatInvalidForInterpolated4,"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."
3371,tcInterpolationMixedWithPercent,"Mismatch in interpolated string. Interpolated strings may not use '%%' format specifiers unless each is given an expression, e.g. '%%d{{1+1}}'"
3372,tcInvalidAlignmentInInterpolatedString,"Invalid alignment in interpolated string"
3373,lexSingleQuoteInSingleQuote,"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."
3374,lexTripleQuoteInTripleQuote,"Invalid interpolated string. Triple quote string literals may not be used in interpolated expressions. Consider using an explicit 'let' binding for the interpolation expression."
3376,tcUnableToParseInterpolatedString,"Invalid interpolated string. %s"
3377,lexByteStringMayNotBeInterpolated,"a byte string may not be interpolated"
3378,parsEofInInterpolatedStringFill,"Incomplete interpolated string expression fill begun at or before here"
3379,parsEofInInterpolatedString,"Incomplete interpolated string begun at or before here"
3380,parsEofInInterpolatedVerbatimString,"Incomplete interpolated verbatim string begun at or before here"
3381,parsEofInInterpolatedTripleQuoteString,"Incomplete interpolated triple-quote string begun at or before here"
3382,lexRBraceInInterpolatedString,"A '}}' character must be escaped (by doubling) in an interpolated string."
#3501 "This construct is not supported by your version of the F# compiler" CompilerMessage(ExperimentalAttributeMessages.NotSupportedYet, 3501, IsError=true)
12 changes: 12 additions & 0 deletions src/fsharp/FSStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,18 @@
<data name="Parser.TOKEN.FIXED" xml:space="preserve">
<value>keyword 'fixed'</value>
</data>
<data name="Parser.TOKEN.INTERP.STRING.BEGIN.END" xml:space="preserve">
<value>interpolated string</value>
</data>
<data name="Parser.TOKEN.INTERP.STRING.BEGIN.PART" xml:space="preserve">
<value>interpolated string (first part)</value>
</data>
<data name="Parser.TOKEN.INTERP.STRING.PART" xml:space="preserve">
<value>interpolated string (part)</value>
</data>
<data name="Parser.TOKEN.INTERP.STRING.END" xml:space="preserve">
<value>interpolated string (final part)</value>
</data>
<data name="Parser.TOKEN.CONSTRAINT" xml:space="preserve">
<value>keyword 'constraint'</value>
</data>
Expand Down
Loading