Skip to content

Fix #19596: unit-parameter member conformance with signature#19614

Closed
T-Gro wants to merge 4 commits intosig-roundtrip-sweepfrom
fix/unit-member-conformance
Closed

Fix #19596: unit-parameter member conformance with signature#19614
T-Gro wants to merge 4 commits intosig-roundtrip-sweepfrom
fix/unit-member-conformance

Conversation

@T-Gro
Copy link
Copy Markdown
Member

@T-Gro T-Gro commented Apr 19, 2026

Fixes #19596

Stacked on #19609.

member M(()) = () produces ValReprInfo [[]] (empty arg group), but sig member M: unit -> unit parses to [[unit_arg]]. Both produce identical IL (.method instance void M()). The conformance checker rejected them because TotalArgCount differs (1 vs 2 including this).

Fix: Relax signature conformance matching for the unit-parameter case:

  • checkValInfo: allow empty impl group [] to match singleton sig group [_]
  • Overloaded matching: fallback using typeAEquivAux EraseNone + TotalArgCount diff=1 guard
  • Single-val [av],[fv] path: same relaxation

Safety:

  • IL verified identical via verifyILContains test
  • EraseNone (not EraseAll) prevents false matches on erased types (UoM)
  • TotalArgCount diff=1 guard restricts to unit-param case only
  • Existing E_StructConstructor01 conformance test still correctly fails
  • Both directions tested with consumer: sig+impl+consumer compiles correctly

T-Gro and others added 4 commits April 19, 2026 19:11
SignatureConformance.fs: when matching overloaded members, add relaxed
fallback for unmatched pairs using type equivalence. This handles
member M(()) (argInfos=[[]]) vs sig member M: unit->unit (argInfos=[[unit_arg]])
where types are equivalent but TotalArgCount differs.

Also relax checkValInfo arg group check: empty impl group is compatible
with singleton sig group for unit-parameter members.

Tests: roundtrip test, handwritten sig+impl+consumer (both directions).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ures

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>
- Consumer cannot call d.M() when impl is M(()) with overloads (FS0503 expected)
- Consumer can call d.M() when impl is M() with sig M: unit -> unit

Covers both directions of sig↔impl conformance with consumer validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@T-Gro T-Gro requested a review from a team as a code owner April 19, 2026 17:13
@T-Gro T-Gro changed the title Fix #19596: overloaded member with unit parameter conformance Fix #19596: unit-parameter member conformance with signature Apr 19, 2026
@T-Gro
Copy link
Copy Markdown
Member Author

T-Gro commented Apr 19, 2026

Reopening as a proper stacked PR using gh-stack

@T-Gro T-Gro closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant