Conversation
There was a problem hiding this comment.
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.
3564e61 to
99613cc
Compare
The deduplication of equivalent types is changed to an algorithm much closer to what Roslyn is doing: