Registry Mirror
Skip to content

Conversation

@dgrunwald

@dgrunwald dgrunwald commented Aug 29, 2026 •

Copy link
Copy Markdown
Member

The deduplication of equivalent types is changed to an algorithm much closer to what Roslyn is doing:

  • uses a dictionary instead of quadratic merging step
  • no need to split the merged candidates back into lower/upper lists
  • supports merging types with different nullability

@siegfriedpammer siegfriedpammer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 3564e61d4 vs merge base 5d9cdce94. Full ICSharpCode.Decompiler.Tests on the branch is green (3463 passed, 0 failed, 45 skipped; ILSpy-tests absent so round-trip did not run).

One blocking finding: a Debug build aborts on a ref object / ref dynamic conditional that the base decompiles fine. The rest are latent or cosmetic; each comment says which.

I checked and cleared these, so they don't need a second look: the MergeNullability table is correct in all 27 cells against Roslyn's Join/Meet/EnsureCompatible, and Combine faithfully reimplements GetTypeArgumentVariance; Debug.Assert(topLevelNullability.HasValue) always holds; dropping pa.GenericType.Equals(pb.GenericType) is safe (the ParameterizedType ctors enforce arity); MoveToImmutable() is filled to capacity; no value-type candidate can gain a ? (ChangeNullability returns this when IsReferenceType == false).

This review was produced by Claude Code (Opus 5) on my behalf; I have NOT checked the reproductions.

This way, we don't need the MapToMergedBounds logic to split the merged list back into lower/upper.
Also, this commit avoids the quadratic merge-everything-with-everything else -- instead we use a dictionary to compare only types that are equivalent to begin with.
This is the same approach as Roslyn MethodTypeInference.Fix/AddAllCandidates.
@dgrunwald
dgrunwald merged commit 05d274f into master Aug 30, 2026
15 checks passed
@siegfriedpammer
siegfriedpammer deleted the type-inference branch August 30, 2026 13:10
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.

2 participants