Skip to content

Commit 03521b2

Browse files
T-GroCopilot
andcommitted
Add IL verification: M(()) and M() produce identical IL method signatures
Proves the conformance relaxation is safe at IL level — both member M(()) and member M() compile to '.method public hidebysig instance int32 M()', confirming the representation difference is compile-time only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c373cc0 commit 03521b2

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,4 +854,21 @@ type D() =
854854
member x.N = x.M { f1 = 3 }
855855
member x.M((y: R1)) = ()
856856
member x.M(()) = ()
857-
"""
857+
"""
858+
859+
// Verify M(()) and M() produce identical IL method signatures
860+
[<Fact>]
861+
let ``Unit param - M(()) and M() produce same IL method signature`` () =
862+
FSharp """
863+
module Test
864+
type D() =
865+
member x.M(()) = 1
866+
member x.M(y: int) = y
867+
"""
868+
|> compile
869+
|> shouldSucceed
870+
|> verifyILContains [
871+
".method public hidebysig instance int32 M() cil managed"
872+
".method public hidebysig instance int32 M(int32 y) cil managed"
873+
]
874+
|> ignore

0 commit comments

Comments
 (0)