From f6b80316120a31b91a7655b36ba946f471e9408d Mon Sep 17 00:00:00 2001 From: Petr Date: Thu, 25 Aug 2022 14:58:21 +0200 Subject: [PATCH 1/2] Update --- src/Compiler/Driver/CompilerOptions.fs | 53 ++++++++++--------- src/Compiler/Driver/CompilerOptions.fsi | 2 + src/Compiler/FSComp.txt | 3 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.de.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.es.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.fr.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.it.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.ja.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.ko.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.pl.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.ru.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.tr.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 15 ++++-- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 15 ++++-- .../ConsoleOnlyOptionsTests.fs | 13 ++++- 17 files changed, 175 insertions(+), 91 deletions(-) diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index e75a449c9e2..8d45e1a85a9 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -263,9 +263,8 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler // returns a tuple - the option token, the option argument string let parseOption (s: string) = - // grab the option token - let opts = s.Split([| ':' |]) - let mutable opt = opts[0] + + let mutable opt = s if opt = "" then () @@ -283,9 +282,13 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler else opt <- "" + // grab the option token + let opts = opt.Split([| ':' |]) + let token = opts[0] + // get the argument string let optArgs = if opts.Length > 1 then String.Join(":", opts[1..]) else "" - opt, optArgs + opt, token, optArgs let getOptionArg compilerOption (argString: string) = if argString = "" then @@ -352,7 +355,7 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler processArg (responseFileOptions @ t) | opt :: t -> - let optToken, argString = parseOption opt + let option, optToken, argString = parseOption opt let reportDeprecatedOption errOpt = match errOpt with @@ -361,7 +364,7 @@ let ParseCompilerOptions (collectOtherArgument: string -> unit, blocks: Compiler let rec attempt l = match l with - | CompilerOption (s, _, OptionConsoleOnly f, d, _) :: _ when optToken = s && argString = "" -> + | CompilerOption (s, _, OptionConsoleOnly f, d, _) :: _ when option = s -> reportDeprecatedOption d f blocks t @@ -710,7 +713,7 @@ let tagAlgorithm = "{SHA1|SHA256}" let tagInt = "" let tagPathMap = "" let tagNone = "" -let tagLangVersionValues = "{?|version|latest|preview}" +let tagLangVersionValues = "{version|latest|preview}" // PrintOptionInfo //---------------- @@ -1104,23 +1107,15 @@ let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) = Some(FSComp.SR.optsMlcompatibility ()) ) -/// LanguageVersion management -let setLanguageVersion specifiedVersion = - - let dumpAllowedValues () = - printfn "%s" (FSComp.SR.optsSupportedLangVersions ()) - - for v in LanguageVersion.ValidOptions do - printfn "%s" v - - for v in LanguageVersion.ValidVersions do - printfn "%s" v - - exit 0 +let GetLanguageVersions () = + seq { + FSComp.SR.optsSupportedLangVersions () + yield! LanguageVersion.ValidOptions + yield! LanguageVersion.ValidVersions + } |> String.concat Environment.NewLine - if specifiedVersion = "?" then - dumpAllowedValues () - elif specifiedVersion.ToUpperInvariant() = "PREVIEW" then +let setLanguageVersion (specifiedVersion: string) = + if specifiedVersion.ToUpperInvariant() = "PREVIEW" then () elif not (LanguageVersion.ContainsVersion specifiedVersion) then error (Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs)) @@ -1130,6 +1125,16 @@ let setLanguageVersion specifiedVersion = let languageFlags tcConfigB = [ // -langversion:? Display the allowed values for language version + CompilerOption( + "langversion:?", + tagNone, + OptionConsoleOnly(fun _ -> + Console.Write(GetLanguageVersions()) + exit 0), + None, + Some(FSComp.SR.optsGetLangVersions ()) + ) + // -langversion: Specify language version such as // 'default' (latest major version), or // 'latest' (latest version, including minor versions), @@ -1140,7 +1145,7 @@ let languageFlags tcConfigB = tagLangVersionValues, OptionString(fun switch -> tcConfigB.langVersion <- setLanguageVersion (switch)), None, - Some(FSComp.SR.optsLangVersion ()) + Some(FSComp.SR.optsSetLangVersion ()) ) CompilerOption( diff --git a/src/Compiler/Driver/CompilerOptions.fsi b/src/Compiler/Driver/CompilerOptions.fsi index 8164393eac4..0915d999032 100644 --- a/src/Compiler/Driver/CompilerOptions.fsi +++ b/src/Compiler/Driver/CompilerOptions.fsi @@ -58,6 +58,8 @@ val GetHelpFsc: tcConfigB: TcConfigBuilder -> blocks: CompilerOptionBlock list - val GetVersion: tcConfigB: TcConfigBuilder -> string +val GetLanguageVersions: unit -> string + val GetCoreFscCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list val GetCoreFsiCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index fa4610bd00b..64f0876b61d 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1523,7 +1523,8 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3353,chkFeatureNotSupportedInLibrary,"Feature '%s' requires the F# library for language version %s or greater." 3360,parsEqualsMissingInTypeDefinition,"Unexpected token in type definition. Expected '=' after the type '%s'." 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'" +optsGetLangVersions,"Display the allowed values for language version." +optsSetLangVersion,"Specify language version such as 'latest' or 'preview'." optsSupportedLangVersions,"Supported language versions:" nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format." nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed." diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 2097d93eac4..8a1853a380f 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Neplatné použití generování referenčního sestavení, nepoužívejte --staticlink ani --refonly a --refout společně. @@ -487,11 +492,6 @@ Neplatná cesta k referenčnímu sestavení - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Zobrazte si povolené hodnoty verze jazyka a pak zadejte požadovanou verzi, například latest nebo preview. - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 11a26276634..e96c8e1d3b2 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht "--staticlink" oder "--refonly" und "--refout" zusammen. @@ -487,11 +492,6 @@ Ungültiger Referenzassemblypfad" - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Zeigen Sie die zulässigen Werte für die Sprachversion an. Geben Sie die Sprachversion als "latest" oder "preview" an. - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 98681bcd9b1..8c034062331 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Uso no válido de emitir un ensamblado de referencia, no use "--staticlink', or '--refonly' and '--refout" de forma conjunta. @@ -487,11 +492,6 @@ Ruta de acceso de ensamblado de referencia no válida - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Mostrar los valores permitidos para la versión de idioma, especificar la versión de idioma como "latest" "preview" - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 5eba08a8603..ab6345e8e0c 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Utilisation non valide de l’émission d’un assembly de référence. N’utilisez pas '--staticlink' ni '--refonly' et '--refout' ensemble. @@ -487,11 +492,6 @@ Chemin d'assemblage de référence non valide' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Afficher les valeurs autorisées pour la version du langage, spécifier la version du langage comme 'dernière' ou 'préversion' - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index b331fef5680..85a4a4cd333 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--staticlink' o '--refonly' e '--refout'. @@ -487,11 +492,6 @@ Percorso assembly di riferimento non valido' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Visualizza i valori consentiti per la versione del linguaggio. Specificare la versione del linguaggio, ad esempio 'latest' o 'preview' - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index dcdf1edc9d2..1a49a44350e 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. 参照アセンブリの生成の使用が無効です。'--staticlink'、または '--refonly' と '--refout' を同時に使用しないでください。 @@ -487,11 +492,6 @@ 参照アセンブリ パスが無効です' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - 言語バージョンで許可された値を表示し、'最新' や 'プレビュー' などの言語バージョンを指定する - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index a88ab838892..1a4cb6964d8 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. 참조 어셈블리 내보내기를 잘못 사용했습니다. '--staticlink' 또는 '--refonly' 및 '--refout'을 함께 사용하지 마세요. @@ -487,11 +492,6 @@ 잘못된 참조 어셈블리 경로' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - 언어 버전의 허용된 값을 표시하고 '최신' 또는 '미리 보기'와 같은 언어 버전을 지정합니다. - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index f71dd1c78a7..1cc8dfb88f1 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Nieprawidłowe użycie emitowania zestawu odwołania, nie używaj razem elementów „--staticlink” ani „--refonly” i „--refout”. @@ -487,11 +492,6 @@ Nieprawidłowa ścieżka zestawu odwołania“ - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Wyświetl dozwolone wartości dla wersji językowej; określ wersję językową, np. „latest” lub „preview” - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 615985563b5..1c898a6234e 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Uso inválido de emitir um assembly de referência, não use '--staticlink' ou '--reutilly' e '--refout' juntos. @@ -487,11 +492,6 @@ Caminho de assembly de referência inválido' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Exibe os valores permitidos para a versão do idioma, especifica a versão do idioma, como 'mais recente ' ou 'prévia' - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index d48f16b89f2..b9094d89e3f 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Недопустимое использование при создании базовой сборки. Не используйте "--staticlink" или "--refonly" и "--refout" вместе. @@ -487,11 +492,6 @@ Неверный путь к базовой сборке' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Отображение допустимых значений для версии языка. Укажите версию языка, например, "latest" или "preview". - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 5f9763a7403..7ee5a8cb3bc 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. Başvuru bütünleştirilmiş kodunun oluşturulması için geçersiz kullanım: '--staticlink' veya '--refonly' ile '--refout' birlikte kullanılmaz. @@ -487,11 +492,6 @@ Geçersiz başvuru bütünleştirilmiş kodu yolu' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Dil sürümü için izin verilen değerleri görüntüleyin, dil sürümünü 'en son' veya 'önizleme' örneklerindeki gibi belirtin - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index e821d6299d1..2659f03165a 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. 发出引用程序集的使用无效,请勿同时使用“--staticlink”或“--refonly”和“--refout”。 @@ -487,11 +492,6 @@ 引用程序集路径无效 - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - 显示语言版本的允许值,指定语言版本,如“最新”或“预览” - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 852c5be20d8..f7f06f543fc 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -477,6 +477,11 @@ Compress interface and optimization data files + + Display the allowed values for language version. + Display the allowed values for language version. + + Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together. 發出參考組件的使用無效,請勿同時使用 '--staticlink' 或 '--refonly' 和 '--refout'。 @@ -487,11 +492,6 @@ 無效的參考組件路徑' - - Display the allowed values for language version, specify language version such as 'latest' or 'preview' - 顯示語言版本允許的值,指定 'latest' 或 'preview' 等語言版本 - - Specify included optimization information, the default is file. Important for distributed libraries. Specify included optimization information, the default is file. Important for distributed libraries. @@ -517,6 +517,11 @@ Disable implicit generation of constructs using reflection + + Specify language version such as 'latest' or 'preview'. + Specify language version such as 'latest' or 'preview'. + + Include F# interface information, the default is file. Essential for distributing libraries. Include F# interface information, the default is file. Essential for distributing libraries. diff --git a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs index b91c0cff0a5..18925d1ff1e 100644 --- a/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ConsoleOnlyOptionsTests.fs @@ -26,10 +26,21 @@ let ``fsc help text is displayed correctly`` () = Assert.AreEqual(expectedHelp, actualHelp, $"Expected: '{expectedHelp}'\n Actual: '{actualHelp}'") |> ignore [] -let ``Version is displayed correctly`` () = +let ``FSC version is displayed correctly`` () = let builder = getArbitraryTcConfigBuilder() let expectedVersionPattern = @"Microsoft \(R\) F# Compiler version \d+\.\d+\.\d+\.\d+ for F# \d+\.\d+" let version = GetVersion builder Assert.That(version, Does.Match expectedVersionPattern) + +[] +let ``Language versions are displayed correctly`` () = + let versions = GetLanguageVersions() + + StringAssert.Contains("Supported language versions", versions) + StringAssert.Contains("preview", versions) + StringAssert.Contains("default", versions) + StringAssert.Contains("latest", versions) + StringAssert.Contains("latestmajor", versions) + StringAssert.Contains("(Default)", versions) \ No newline at end of file From 761a99856dbebf92da1b842cea66150d4778045f Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 9 Sep 2022 16:55:34 +0200 Subject: [PATCH 2/2] Update --- src/Compiler/Driver/CompilerOptions.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 8d45e1a85a9..4e3aa03217a 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -1108,11 +1108,12 @@ let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) = ) let GetLanguageVersions () = - seq { + seq { FSComp.SR.optsSupportedLangVersions () yield! LanguageVersion.ValidOptions yield! LanguageVersion.ValidVersions - } |> String.concat Environment.NewLine + } + |> String.concat Environment.NewLine let setLanguageVersion (specifiedVersion: string) = if specifiedVersion.ToUpperInvariant() = "PREVIEW" then