Skip to content

Share the lookup and overload-resolution stages - #4147

Merged
siegfriedpammer merged 1 commit into
masterfrom
refactor/unify-ambiguity-checks
Sep 19, 2026
Merged

siegfriedpammer merged 1 commit into
masterfrom
refactor/unify-ambiguity-checks

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Follow-up to #4144.

The three IsUnambiguous* checks in Disambiguator each spelled out the same
shape: bind the name from the target (or unqualified when there is none), then
decide whether what came back is the member the IL referenced. Two helpers now
carry the parts that are literally identical:

helper used by
LookUpName IsUnambiguousCall, IsUnambiguousAccess (non-indexer), IsUnambiguousMethodReference
CheckBestCandidate IsUnambiguousCall, IsUnambiguousAccess (indexer)

A change to how a name is bound, or how a best candidate is verified, can no
longer reach one check and miss another.

Two checks deliberately keep their own code:

  • The method group. It does not reject BestCandidateErrors or an ambiguous
    result, and a method group carries no arguments to be ambiguous over. Whether
    that should hold for the type arguments too is untested, so it is left as it
    was rather than tightened blind.
  • Field access. A field is reached by plain name equality and has no virtual
    dispatch for IsAppropriateCallTarget to tolerate.

No intended change to decompiler output.

Verification

  • ILSpy.XPlat.slnf: 3781 tests, 0 failed (49 Windows-gated skips).
  • decompdiff over the top-200 corpus: pending, will be posted here.

This PR description was written by an AI agent (Claude Opus 5) working under
@siegfriedpammer's direction.

The three IsUnambiguous* checks each spelled out the same shape: bind the
name from the target (or unqualified when there is none), then decide whether
what came back is the member the IL referenced. Two helpers now carry the
parts that are literally identical, so a change to how a name is bound or how
a best candidate is verified cannot reach one check and miss another.

The method-group check keeps its own verification: it does not reject
BestCandidateErrors or an ambiguous result, and whether it should is untested,
so it is left as it was rather than tightened blind. Field access keeps its
own probe too - a field is reached by plain name equality and has no virtual
dispatch for IsAppropriateCallTarget to tolerate.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 29b3480 into master Sep 19, 2026
17 checks passed
@siegfriedpammer
siegfriedpammer deleted the refactor/unify-ambiguity-checks branch September 19, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant