Skip to content

Commit f6b8031

Browse files
committed
Update
1 parent 2b391ff commit f6b8031

17 files changed

+175
-91
lines changed

src/Compiler/Driver/CompilerOptions.fs

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler
263263

264264
// returns a tuple - the option token, the option argument string
265265
let parseOption (s: string) =
266-
// grab the option token
267-
let opts = s.Split([| ':' |])
268-
let mutable opt = opts[0]
266+
267+
let mutable opt = s
269268

270269
if opt = "" then
271270
()
@@ -283,9 +282,13 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler
283282
else
284283
opt <- ""
285284

285+
// grab the option token
286+
let opts = opt.Split([| ':' |])
287+
let token = opts[0]
288+
286289
// get the argument string
287290
let optArgs = if opts.Length > 1 then String.Join(":", opts[1..]) else ""
288-
opt, optArgs
291+
opt, token, optArgs
289292

290293
let getOptionArg compilerOption (argString: string) =
291294
if argString = "" then
@@ -352,7 +355,7 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler
352355

353356
processArg (responseFileOptions @ t)
354357
| opt :: t ->
355-
let optToken, argString = parseOption opt
358+
let option, optToken, argString = parseOption opt
356359

357360
let reportDeprecatedOption errOpt =
358361
match errOpt with
@@ -361,7 +364,7 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler
361364

362365
let rec attempt l =
363366
match l with
364-
| CompilerOption (s, _, OptionConsoleOnly f, d, _) :: _ when optToken = s && argString = "" ->
367+
| CompilerOption (s, _, OptionConsoleOnly f, d, _) :: _ when option = s ->
365368
reportDeprecatedOption d
366369
f blocks
367370
t
@@ -710,7 +713,7 @@ let tagAlgorithm = "{SHA1|SHA256}"
710713
let tagInt = "<n>"
711714
let tagPathMap = "<path=sourcePath;...>"
712715
let tagNone = ""
713-
let tagLangVersionValues = "{?|version|latest|preview}"
716+
let tagLangVersionValues = "{version|latest|preview}"
714717

715718
// PrintOptionInfo
716719
//----------------
@@ -1104,23 +1107,15 @@ let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) =
11041107
Some(FSComp.SR.optsMlcompatibility ())
11051108
)
11061109

1107-
/// LanguageVersion management
1108-
let setLanguageVersion specifiedVersion =
1109-
1110-
let dumpAllowedValues () =
1111-
printfn "%s" (FSComp.SR.optsSupportedLangVersions ())
1112-
1113-
for v in LanguageVersion.ValidOptions do
1114-
printfn "%s" v
1115-
1116-
for v in LanguageVersion.ValidVersions do
1117-
printfn "%s" v
1118-
1119-
exit 0
1110+
let GetLanguageVersions () =
1111+
seq {
1112+
FSComp.SR.optsSupportedLangVersions ()
1113+
yield! LanguageVersion.ValidOptions
1114+
yield! LanguageVersion.ValidVersions
1115+
} |> String.concat Environment.NewLine
11201116

1121-
if specifiedVersion = "?" then
1122-
dumpAllowedValues ()
1123-
elif specifiedVersion.ToUpperInvariant() = "PREVIEW" then
1117+
let setLanguageVersion (specifiedVersion: string) =
1118+
if specifiedVersion.ToUpperInvariant() = "PREVIEW" then
11241119
()
11251120
elif not (LanguageVersion.ContainsVersion specifiedVersion) then
11261121
error (Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs))
@@ -1130,6 +1125,16 @@ let setLanguageVersion specifiedVersion =
11301125
let languageFlags tcConfigB =
11311126
[
11321127
// -langversion:? Display the allowed values for language version
1128+
CompilerOption(
1129+
"langversion:?",
1130+
tagNone,
1131+
OptionConsoleOnly(fun _ ->
1132+
Console.Write(GetLanguageVersions())
1133+
exit 0),
1134+
None,
1135+
Some(FSComp.SR.optsGetLangVersions ())
1136+
)
1137+
11331138
// -langversion:<string> Specify language version such as
11341139
// 'default' (latest major version), or
11351140
// 'latest' (latest version, including minor versions),
@@ -1140,7 +1145,7 @@ let languageFlags tcConfigB =
11401145
tagLangVersionValues,
11411146
OptionString(fun switch -> tcConfigB.langVersion <- setLanguageVersion (switch)),
11421147
None,
1143-
Some(FSComp.SR.optsLangVersion ())
1148+
Some(FSComp.SR.optsSetLangVersion ())
11441149
)
11451150

11461151
CompilerOption(

src/Compiler/Driver/CompilerOptions.fsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ val GetHelpFsc: tcConfigB: TcConfigBuilder -> blocks: CompilerOptionBlock list -
5858

5959
val GetVersion: tcConfigB: TcConfigBuilder -> string
6060

61+
val GetLanguageVersions: unit -> string
62+
6163
val GetCoreFscCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list
6264

6365
val GetCoreFsiCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list

src/Compiler/FSComp.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,8 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
15231523
3353,chkFeatureNotSupportedInLibrary,"Feature '%s' requires the F# library for language version %s or greater."
15241524
3360,parsEqualsMissingInTypeDefinition,"Unexpected token in type definition. Expected '=' after the type '%s'."
15251525
useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)."
1526-
optsLangVersion,"Display the allowed values for language version, specify language version such as 'latest' or 'preview'"
1526+
optsGetLangVersions,"Display the allowed values for language version."
1527+
optsSetLangVersion,"Specify language version such as 'latest' or 'preview'."
15271528
optsSupportedLangVersions,"Supported language versions:"
15281529
nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format."
15291530
nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed."

src/Compiler/xlf/FSComp.txt.cs.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně.</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">Neplatná cesta k referenčnímu sestavení</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">Zobrazte si povolené hodnoty verze jazyka a pak zadejte požadovanou verzi, například latest nebo preview.</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

src/Compiler/xlf/FSComp.txt.de.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen.</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">Ungültiger Referenzassemblypfad"</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">Zeigen Sie die zulässigen Werte für die Sprachversion an. Geben Sie die Sprachversion als "latest" oder "preview" an.</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

src/Compiler/xlf/FSComp.txt.es.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">Uso no válido de emitir un ensamblado de referencia, no use "--staticlink', or '--refonly' and '--refout" de forma conjunta.</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">Ruta de acceso de ensamblado de referencia no válida</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">Mostrar los valores permitidos para la versión de idioma, especificar la versión de idioma como "latest" "preview"</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

src/Compiler/xlf/FSComp.txt.fr.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">Utilisation non valide de l’émission d’un assembly de référence. N’utilisez pas '--staticlink' ni '--refonly' et '--refout' ensemble.</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">Chemin d'assemblage de référence non valide'</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">Afficher les valeurs autorisées pour la version du langage, spécifier la version du langage comme 'dernière' ou 'préversion'</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

src/Compiler/xlf/FSComp.txt.it.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'.</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">Percorso assembly di riferimento non valido'</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">Visualizza i valori consentiti per la versione del linguaggio. Specificare la versione del linguaggio, ad esempio 'latest' o 'preview'</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

src/Compiler/xlf/FSComp.txt.ja.xlf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@
477477
<target state="new">Compress interface and optimization data files</target>
478478
<note />
479479
</trans-unit>
480+
<trans-unit id="optsGetLangVersions">
481+
<source>Display the allowed values for language version.</source>
482+
<target state="new">Display the allowed values for language version.</target>
483+
<note />
484+
</trans-unit>
480485
<trans-unit id="optsInvalidRefAssembly">
481486
<source>Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together.</source>
482487
<target state="translated">参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。</target>
@@ -487,11 +492,6 @@
487492
<target state="translated">参照アセンブリ パスが無効です'</target>
488493
<note />
489494
</trans-unit>
490-
<trans-unit id="optsLangVersion">
491-
<source>Display the allowed values for language version, specify language version such as 'latest' or 'preview'</source>
492-
<target state="translated">言語バージョンで許可された値を表示し、'最新' や 'プレビュー' などの言語バージョンを指定する</target>
493-
<note />
494-
</trans-unit>
495495
<trans-unit id="optsOptimizationData">
496496
<source>Specify included optimization information, the default is file. Important for distributed libraries.</source>
497497
<target state="new">Specify included optimization information, the default is file. Important for distributed libraries.</target>
@@ -517,6 +517,11 @@
517517
<target state="new">Disable implicit generation of constructs using reflection</target>
518518
<note />
519519
</trans-unit>
520+
<trans-unit id="optsSetLangVersion">
521+
<source>Specify language version such as 'latest' or 'preview'.</source>
522+
<target state="new">Specify language version such as 'latest' or 'preview'.</target>
523+
<note />
524+
</trans-unit>
520525
<trans-unit id="optsSignatureData">
521526
<source>Include F# interface information, the default is file. Essential for distributing libraries.</source>
522527
<target state="new">Include F# interface information, the default is file. Essential for distributing libraries.</target>

0 commit comments

Comments
 (0)