mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Whether an unresolvable type is a reference type is not a property of the type but of the metadata that mentioned it: a signature spelling it `valuetype T` yields false, a bare TypeRef yields null. UnknownType.Equals compares the flag, so the two spellings of one missing type compared unequal and EquivalentTypes reported false - the decompiler then emitted a cast between a type and itself. Erasing the flag in NormalizeTypeVisitor keeps the relaxation inside the comparisons that ask for erasure, next to the nullability, modopt and tuple erasure that are use-site spellings of the same kind. Dropping the term from UnknownType.Equals instead was measured and rejected: Equals also keys CSharpConversions' implicit-conversion cache, where merging the two spellings lets whichever conversion is computed first answer for both, adding 398 boxing casts across two real-world assemblies. Assisted-by: Claude:claude-opus-5[1m]:Claude Codepull/4070/head
3 changed files with 24 additions and 1 deletions
Loading…
Reference in new issue