Fix #19596: unit-parameter member conformance with signature#19614
Closed
T-Gro wants to merge 4 commits intosig-roundtrip-sweepfrom
Closed
Fix #19596: unit-parameter member conformance with signature#19614T-Gro wants to merge 4 commits intosig-roundtrip-sweepfrom
T-Gro wants to merge 4 commits intosig-roundtrip-sweepfrom
Conversation
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>
Member
Author
|
Reopening as a proper stacked PR using gh-stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19596
Stacked on #19609.
member M(()) = ()produces ValReprInfo[[]](empty arg group), but sigmember M: unit -> unitparses to[[unit_arg]]. Both produce identical IL (.method instance void M()). The conformance checker rejected them becauseTotalArgCountdiffers (1 vs 2 includingthis).Fix: Relax signature conformance matching for the unit-parameter case:
checkValInfo: allow empty impl group[]to match singleton sig group[_]typeAEquivAux EraseNone+TotalArgCountdiff=1 guard[av],[fv]path: same relaxationSafety:
verifyILContainstestEraseNone(notEraseAll) prevents false matches on erased types (UoM)TotalArgCountdiff=1 guard restricts to unit-param case onlyE_StructConstructor01conformance test still correctly fails