Conversation
UniqueType#eql? compared the raw @rooted ivar on the left against the rooted? reader on the right. rooted? is "!can_root_name? || @rooted", so for a name that cannot be rooted -- a lowercase name such as undefined -- the reader returns true while the ivar is false. That comparison was therefore permanently false, and no undefined type was equal to any other, including to itself: a.eql?(a) returned false. Anything relying on Ruby equality of types rather than tag-string equality was affected. Two distinct undefined objects deduplicated to two entries under uniq, missed each other under Set#include?, and failed to find each other as Hash keys. UNDEFINED and UNDEFINED.erase_parameters additionally broke the eql?/hash contract outright. erase_parameters passes "rooted: rooted?", so it stores @rooted = true where the constant stores false: eql? was asymmetric between them, true in one direction and false in the other, while their hashes differed. Compare rooted? on both sides rather than both raw ivars. For a name that can be rooted the two spellings are identical; for a name that cannot, rootedness carries no meaning, so two such types are the same type whichever flag they were constructed with. hash has to move with eql? or that erase_parameters pair becomes equal with differing hashes, so it now reads rooted? too.
apiology
marked this pull request as ready for review
October 4, 2026 14:57
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.
Claude: This PR was written by Claude Code on behalf of @apiology.
ComplexType::UniqueType#eql?compares the raw@rootedivar on the left against therooted?reader on the right, androoted?is!can_root_name? || @rooted. For a name that cannot be rooted —undefinedis the case that arises in practice — the reader returnstruewhile the ivar isfalse, so that clause is permanently false and anundefinedtype is not equal even to itself. Anything relying on Ruby equality of types rather than tag-string equality silently treats twoundefinedtypes as distinct.Compare
rooted?on both sides rather than both raw ivars: where a name can be rooted the two spellings are identical, and where it cannot, rootedness carries no meaning, so two such types are the same type whichever flag built them.hashmoves with it, since it read@rootedand would otherwise leave thaterase_parameterspair equal but hashed differently.