Skip to content

Commit dcf7db7

Browse files
T-GroKevinRansom
andauthored
Change realSig to be false by default (#17631)
* Change realSig to be `false` by default * Adjust tests * fantomas'd * quickinfo test * Update Tests.LanguageService.QuickInfo.fs --------- Co-authored-by: Kevin Ransom (msft) <[email protected]>
1 parent 9bf5b86 commit dcf7db7

File tree

8 files changed

+52
-52
lines changed

8 files changed

+52
-52
lines changed

src/Compiler/Driver/CompilerConfig.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ type TcConfigBuilder =
831831
DumpGraph = false
832832
}
833833
dumpSignatureData = false
834-
realsig = true
834+
realsig = false
835835
strictIndentation = None
836836
}
837837

tests/FSharp.Test.Utilities/CompilerAssert.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,9 @@ Updated automatically, please check diffs in your pull request, changes must be
10061006
static member CompileLibraryAndVerifyIL((source: string), (f: ILVerifier -> unit)) =
10071007
compileLibraryAndVerifyILWithOptions [||] (SourceCodeFileKind.Create("test.fs", source)) f
10081008

1009+
static member CompileLibraryAndVerifyILRealSig((source: string), (f: ILVerifier -> unit)) =
1010+
compileLibraryAndVerifyILWithOptions [|"--realsig+"|] (SourceCodeFileKind.Create("test.fs", source)) f
1011+
10091012
static member RunScriptWithOptionsAndReturnResult options (source: string) =
10101013
// Initialize output and input streams
10111014
use inStream = new StringReader("")

tests/fsharp/Compiler/CodeGen/EmittedIL/DelegateAndFuncOptimizations.fs

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ let ApplyComputedFunction(c: int) =
494494

495495
[<Test>]
496496
// See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md
497+
// See also https://github.com/dotnet/fsharp/issues/17607 for a regression caused by realsig+ becoming default
498+
// This test case must keep using direct call to ReduceComputedDelegate, and not a FSharpFunc invocation.
497499
let ``Reduce Computed Delegate with let rec``() =
498500
CompilerAssert.CompileLibraryAndVerifyIL(
499501
"""
@@ -506,31 +508,25 @@ let ApplyComputedDelegate(c: int) =
506508
""",
507509
(fun verifier -> verifier.VerifyIL [
508510
"""
509-
.method public static int32 ApplyComputedDelegate(int32 c) cil managed
510-
{
511-
512-
.maxstack 4
513-
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,int32> V_0,
514-
class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_1)
515-
IL_0000: ldsfld class ReduceComputedDelegate/f@7 ReduceComputedDelegate/f@7::@_instance
516-
IL_0005: stloc.0
517-
IL_0006: ldstr "hello"
518-
IL_000b: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
519-
IL_0010: stloc.1
520-
IL_0011: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out()
521-
IL_0016: ldloc.1
522-
IL_0017: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [runtime]System.IO.TextWriter,
523-
class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
524-
IL_001c: pop
525-
IL_001d: ldloc.0
526-
IL_001e: ldarg.0
527-
IL_001f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,int32>::Invoke(!0)
528-
IL_0024: ldc.i4.3
529-
IL_0025: add
530-
IL_0026: ret
511+
.method public static int32 ApplyComputedDelegate(int32 c) cil managed
512+
{
513+
514+
.maxstack 4
515+
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0)
516+
IL_0000: ldstr "hello"
517+
IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
518+
IL_000a: stloc.0
519+
IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out()
520+
IL_0010: ldloc.0
521+
IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [runtime]System.IO.TextWriter,
522+
class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
523+
IL_0016: pop
524+
IL_0017: ldarg.0
525+
IL_0018: call int32 ReduceComputedDelegate::f@7(int32)
526+
IL_001d: ldc.i4.3
527+
IL_001e: add
528+
IL_001f: ret
531529
}
532-
533-
}
534530
"""
535531
]))
536532

tests/fsharp/Compiler/CodeGen/EmittedIL/Mutation.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module ``Mutation`` =
1313
[<Test>]
1414
let ``Mutation 01``() =
1515
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
16-
[|"-g"; "--optimize-"|],
16+
[|"-g"; "--optimize-";"--realsig+"|],
1717
"""
1818
module Mutation01
1919
type Test = struct
@@ -48,7 +48,7 @@ type Test = struct
4848
[<Test>]
4949
let ``Mutation 02``() =
5050
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
51-
[|"-g"; "--optimize-"|],
51+
[|"-g"; "--optimize-";"--realsig+"|],
5252
"""
5353
module Mutation02
5454
let x = System.TimeSpan.MinValue
@@ -94,7 +94,7 @@ x.ToString()
9494
[<Test>]
9595
let ``Mutation 03``() =
9696
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
97-
[|"-g"; "--optimize-"|],
97+
[|"-g"; "--optimize-";"--realsig+"|],
9898
"""
9999
module Mutation03
100100
let x = System.DateTime.Now
@@ -139,7 +139,7 @@ x.Day
139139
[<Test>]
140140
let ``Mutation 04``() =
141141
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
142-
[|"-g"; "--optimize-"|],
142+
[|"-g"; "--optimize-";"--realsig+"|],
143143
"""
144144
module Mutation04
145145
let x = System.Decimal.MaxValue
@@ -185,7 +185,7 @@ x.ToString()
185185
[<Test>]
186186
let ``Mutation 05``() =
187187
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
188-
[|"-g"; "--optimize-"|],
188+
[|"-g"; "--optimize-";"--realsig+"|],
189189
"""
190190
module Mutation05
191191
type C() =

tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module ``Static Member`` =
1010

1111
[<Test>]
1212
let ``Action on Static Member``() =
13-
CompilerAssert.CompileLibraryAndVerifyIL(
13+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
1414
"""
1515
module StaticMember01
1616
@@ -74,7 +74,7 @@ type C =
7474

7575
[<Test>]
7676
let ``Action on Static Member with lambda``() =
77-
CompilerAssert.CompileLibraryAndVerifyIL(
77+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
7878
"""
7979
module StaticMember02
8080
@@ -133,7 +133,7 @@ type C =
133133

134134
[<Test>]
135135
let ``Action on Static Member with closure``() =
136-
CompilerAssert.CompileLibraryAndVerifyIL(
136+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
137137
"""
138138
module StaticMember03
139139
@@ -247,7 +247,7 @@ let main _ =
247247

248248
[<Test>]
249249
let ``Func on Static Member``() =
250-
CompilerAssert.CompileLibraryAndVerifyIL(
250+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
251251
"""
252252
module StaticMember04
253253
@@ -313,7 +313,7 @@ type C =
313313

314314
[<Test>]
315315
let ``Func on Static Member with lambda``() =
316-
CompilerAssert.CompileLibraryAndVerifyIL(
316+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
317317
"""
318318
module StaticMember05
319319
@@ -379,7 +379,7 @@ type C =
379379

380380
[<Test>]
381381
let ``Func on Static Member with closure``() =
382-
CompilerAssert.CompileLibraryAndVerifyIL(
382+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
383383
"""
384384
module StaticMember06
385385
@@ -434,7 +434,7 @@ let main _ =
434434
#if !FX_NO_WINFORMS
435435
[<Test>]
436436
let ``EventHandler from Regression/83``() =
437-
CompilerAssert.CompileLibraryAndVerifyIL(
437+
CompilerAssert.CompileLibraryAndVerifyILRealSig(
438438
"""
439439
module StaticMember07
440440

tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module TaskGeneratedCode =
2929
[<Test>]
3030
let ``check MoveNext of simple task debug``() =
3131
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
32-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
32+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
3333
"""
3434
module Test
3535
@@ -116,7 +116,7 @@ let testTask() = task { return 1 }
116116
[<Test>]
117117
let ``check MoveNext of simple task optimized``() =
118118
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
119-
[| "/optimize+"; "/debug:portable"; "/tailcalls+" |],
119+
[| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |],
120120
"""
121121
module Test
122122
@@ -190,7 +190,7 @@ let testTask() = task { return 1 }
190190
[<Test>]
191191
let ``check MoveNext of simple binding task debug``() =
192192
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
193-
[| "/debug:portable"; "/optimize-"; "/tailcalls-" |],
193+
[| "/debug:portable";"--realsig+"; "/optimize-"; "/tailcalls-" |],
194194
"""
195195
module Test
196196
open System.Threading.Tasks
@@ -370,7 +370,7 @@ module TaskTryFinallyGeneration =
370370
[<Test>]
371371
let ``check MoveNext of task try/finally optimized``() =
372372
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
373-
[| "/optimize+"; "/debug:portable"; "/tailcalls+" |],
373+
[| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |],
374374
"""
375375
module Test
376376
@@ -479,7 +479,7 @@ let testTask() = task { try 1+1 finally System.Console.WriteLine("finally") }
479479
[<Test>]
480480
let ``check MoveNext of task try/finally debug``() =
481481
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
482-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
482+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
483483
"""
484484
module Test
485485
@@ -596,7 +596,7 @@ module TaskTryWithGeneration =
596596
[<Test>]
597597
let ``check MoveNext of task try/with optimized``() =
598598
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
599-
[| "/optimize+"; "/debug:portable"; "/tailcalls+" |],
599+
[| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |],
600600
"""
601601
module Test
602602
@@ -709,7 +709,7 @@ let testTask() = task { try 1 with e -> System.Console.WriteLine("finally"); 2 }
709709
[<Test>]
710710
let ``check MoveNext of task try/with debug``() =
711711
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
712-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
712+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
713713
"""
714714
module Test
715715
@@ -829,7 +829,7 @@ module TaskWhileLoopGeneration =
829829
[<Test>]
830830
let ``check MoveNext of task while loop optimized``() =
831831
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
832-
[| "/optimize+"; "/debug:portable"; "/tailcalls+" |],
832+
[| "/optimize+"; "/debug:portable";"--realsig+"; "/tailcalls+" |],
833833
"""
834834
module Test
835835
@@ -927,7 +927,7 @@ let testTask() = task { while x > 4 do System.Console.WriteLine("loop") }
927927
[<Test>]
928928
let ``check MoveNext of task while loop debug``() =
929929
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
930-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
930+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
931931
"""
932932
module Test
933933
@@ -1030,7 +1030,7 @@ module TaskTypeInference =
10301030
[<Test>]
10311031
let ``check initially ambiguous SRTP task code ``() =
10321032
CompilerAssert.CompileExeAndRunWithOptions(
1033-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
1033+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
10341034
"""
10351035
module Test
10361036
@@ -1050,7 +1050,7 @@ let myTuple : (string -> Task<unit>) * int = (fun (_s: string) -> Task.FromResul
10501050
[<Test>]
10511051
let ``check generic task code ``() =
10521052
CompilerAssert.CompileExeAndRunWithOptions(
1053-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
1053+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
10541054
"""
10551055
module Test
10561056
@@ -1083,7 +1083,7 @@ printfn "test passed"
10831083
[<Test>]
10841084
let ``check generic task exact code``() =
10851085
CompilerAssert.CompileLibraryAndVerifyILWithOptions(
1086-
[| "/optimize-"; "/debug:portable"; "/tailcalls-" |],
1086+
[| "/optimize-"; "/debug:portable";"--realsig+"; "/tailcalls-" |],
10871087
"""
10881088
module Test
10891089

vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module QuickInfo =
3131
let internal GetQuickInfo (code: string) caretPosition =
3232
asyncMaybe {
3333
let document =
34-
RoslynTestHelpers.CreateSolution(code) |> RoslynTestHelpers.GetSingleDocument
34+
RoslynTestHelpers.CreateSolution(code, extraFSharpProjectOtherOptions = [| "--realsig+" |])
35+
|> RoslynTestHelpers.GetSingleDocument
3536

3637
let! _, _, _, tooltip =
3738
FSharpAsyncQuickInfoSource.TryGetToolTip(document, caretPosition)
@@ -534,7 +535,7 @@ module Test =
534535
static let fu$$nc x = ()
535536
"""
536537

537-
let expectedSignature = "val private func: x: 'a -> unit"
538+
let expectedSignature = "val func: x: 'a -> unit"
538539

539540
let tooltip = GetQuickInfoTextFromCode code
540541

vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n")
790790
type A() =
791791
let fff n = n + 1
792792
"""
793-
this.AssertQuickInfoContainsAtEndOfMarker(code, "let ff", "val private fff: n: int -> int")
793+
this.AssertQuickInfoContainsAtEndOfMarker(code, "let ff", "val fff: n: int -> int")
794794

795795
// Regression for 2494
796796
[<Test>]

0 commit comments

Comments
 (0)