Skip to content

Commit

Permalink
Fix 17561 - FS0243 - Unrecognized option: '--realsig- (dotnet#17562)
Browse files Browse the repository at this point in the history
* Fix 17561

* tests
  • Loading branch information
KevinRansom authored Aug 20, 2024
1 parent 02adf13 commit b1b810f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 63 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fix for exponential runtime in CE builders when using nested implicit yields [PR #17096](https://github.com/dotnet/fsharp/pull/17096)
* Fix several AND operator parser bugs and regressions ([Issue #16447](https://github.com/dotnet/fsharp/issues/16447), [Issue #17134](https://github.com/dotnet/fsharp/issues/17134), [Issue #16309](https://github.com/dotnet/fsharp/issues/16309), [PR #17113](https://github.com/dotnet/fsharp/pull/17113))
* Treat exceptions as types in a namespace for graph based type checking ([Issue #17262](https://github.com/dotnet/fsharp/issues/17262), [PR #17268](https://github.com/dotnet/fsharp/pull/17268))
* FS0243 - Unrecognized option: '--realsig-' #17561 ([Issue #17561](https://github.com/dotnet/fsharp/issues/17561), [PR #17268](https://github.com/dotnet/fsharp/pull/17562))

### Added

Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- F# Version components -->
<FSMajorVersion>8</FSMajorVersion>
<FSMinorVersion>0</FSMinorVersion>
<FSBuildVersion>400</FSBuildVersion>
<FSBuildVersion>401</FSBuildVersion>
<FSRevisionVersion>0</FSRevisionVersion>
<!-- -->
<!-- F# Language version -->
Expand Down
17 changes: 10 additions & 7 deletions src/FSharp.Build/Fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type public Fsc() as this =
let mutable preferredUILang: string MaybeNull = null
let mutable publicSign: bool = false
let mutable provideCommandLineArgs: bool = false
let mutable realsig: bool = false
let mutable realsig: bool option = None
let mutable references: ITaskItem[] = [||]
let mutable referencePath: string MaybeNull = null
let mutable refOnly: bool = false
Expand Down Expand Up @@ -196,10 +196,10 @@ type public Fsc() as this =
builder.AppendSwitch("--optimize-")

// realsig
if realsig then
builder.AppendSwitch("--realsig+")
else
builder.AppendSwitch("--realsig-")
match realsig with
| Some true -> builder.AppendSwitch("--realsig+")
| Some false -> builder.AppendSwitch("--realsig-")
| None -> ()

// Tailcalls
if not tailcalls then
Expand Down Expand Up @@ -539,8 +539,11 @@ type public Fsc() as this =

// --realsig[+-]
member _.RealSig
with get () = realsig
and set (b) = realsig <- b
with get () =
match realsig with
| Some true -> true
| _ -> false
and set (b) = realsig <- Some b

// -r <string>: Reference an F# or .NET assembly.
member _.References
Expand Down
55 changes: 0 additions & 55 deletions vsintegration/tests/UnitTests/Tests.Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--codepage:65001" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -95,7 +94,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("-g" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -111,7 +109,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--debug:pdbonly" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -129,7 +126,6 @@ type Build() =
AssertEqual ("--define:FOO=3" + Environment.NewLine +
"--define:BAR=4" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -144,7 +140,6 @@ type Build() =
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--nowarn:52,109" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -160,7 +155,6 @@ type Build() =
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -175,7 +169,6 @@ type Build() =
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--warnaserror-:52,109" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -189,9 +182,7 @@ type Build() =
tool.VersionFile <- "src/version"
AssertEqual "src/version" tool.VersionFile
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--versionfile:src/version" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -208,7 +199,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--doc:foo.xml" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -224,7 +214,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--sig:foo.fsi" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -240,7 +229,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--keyfile:key.txt" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -256,7 +244,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("--noframework" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -269,9 +256,7 @@ type Build() =
tool.Optimize <- false
AssertEqual false tool.Optimize
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize-" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -285,9 +270,7 @@ type Build() =
AssertEqual true tool.Tailcalls
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
// REVIEW we don't put the default, is that desired?
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -300,9 +283,7 @@ type Build() =
tool.OtherFlags <- "--yadda yadda"
AssertEqual "--yadda yadda" tool.OtherFlags
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -320,7 +301,6 @@ type Build() =
printfn "cmd=\"%s\"" cmd
AssertEqual ("-o:oUt.dll" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -333,9 +313,7 @@ type Build() =
tool.PdbFile <- "out.pdb"
AssertEqual "out.pdb" tool.PdbFile
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--pdb:out.pdb" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -349,9 +327,7 @@ type Build() =
tool.Platform <- "x64"
AssertEqual "x64" tool.Platform
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--platform:x64" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -365,9 +341,7 @@ type Build() =
tool.Platform <- "x86"
AssertEqual "x86" tool.Platform
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--platform:x86" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -382,9 +356,7 @@ type Build() =
tool.References <- [| MakeTaskItem dll |]
AssertEqual 1 tool.References.Length
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"-r:" + dll + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -399,9 +371,7 @@ type Build() =
tool.ReferencePath <- path
AssertEqual path tool.ReferencePath
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--lib:c:\\sd\\staging\\tools\\nunit\\,c:\\Foo" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -416,9 +386,7 @@ type Build() =
tool.ReferencePath <- path
AssertEqual path tool.ReferencePath
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--lib:c:\\program files,c:\\sd\\staging\\tools\\nunit,c:\\Foo" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -432,9 +400,7 @@ type Build() =
tool.Resources <- [| MakeTaskItem "Foo.resources" |]
AssertEqual 1 tool.Resources.Length
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--resource:Foo.resources" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -450,9 +416,7 @@ type Build() =
tool.Sources <- [| iti; iti |]
AssertEqual 2 tool.Sources.Length
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva-" + Environment.NewLine +
Expand All @@ -468,9 +432,7 @@ type Build() =
tool.TargetType <- "Library"
AssertEqual "Library" tool.TargetType
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--target:library" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -484,9 +446,7 @@ type Build() =
tool.TargetType <- "Winexe"
AssertEqual "Winexe" tool.TargetType
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--target:winexe" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -500,9 +460,7 @@ type Build() =
tool.TargetType <- "Module"
AssertEqual "Module" tool.TargetType
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--target:module" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -515,9 +473,7 @@ type Build() =
let tool = new FSharp.Build.Fsc()
tool.Utf8Output <- true
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--utf8output" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -530,9 +486,7 @@ type Build() =
let tool = new FSharp.Build.Fsc()
tool.Win32ResourceFile <- "foo.res"
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--win32res:foo.res" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -545,9 +499,7 @@ type Build() =
let tool = new FSharp.Build.Fsc()
tool.Win32ManifestFile <- "foo.manifest"
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--win32manifest:foo.manifest" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand All @@ -560,9 +512,7 @@ type Build() =
let tool = new FSharp.Build.Fsc()
tool.HighEntropyVA <- true
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--highentropyva+" + Environment.NewLine +
Expand All @@ -574,9 +524,7 @@ type Build() =
let tool = new FSharp.Build.Fsc()
tool.SubsystemVersion <- "6.02"
let cmd = tool.InternalGenerateResponseFileCommands()
printfn "cmd=\"%s\"" cmd
AssertEqual ("--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
"--subsystemversion:6.02" + Environment.NewLine +
Expand Down Expand Up @@ -631,7 +579,6 @@ type Build() =
"--sig:foo.fsi" + Environment.NewLine +
"--keyfile:key.txt" + Environment.NewLine +
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--pdb:out.pdb" + Environment.NewLine +
"--platform:anycpu" + Environment.NewLine +
"--resource:MyRes.resources" + Environment.NewLine +
Expand Down Expand Up @@ -675,7 +622,6 @@ type Build() =
"--sig:foo.fsi"
"--keyfile:key.txt"
"--optimize+"
"--realsig-"
"--pdb:out.pdb"
"--platform:anycpu"
"--resource:MyRes.resources"
Expand Down Expand Up @@ -719,7 +665,6 @@ type Build() =

let expected =
"--optimize+" + Environment.NewLine +
"--realsig-" + Environment.NewLine +
"--nowarn:52,109,110,73,85" + Environment.NewLine +
"--fullpaths" + Environment.NewLine +
"--flaterrors" + Environment.NewLine +
Expand Down

0 comments on commit b1b810f

Please sign in to comment.