Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare property default instance locations by id #180

Merged
merged 2 commits into from
Mar 14, 2024

Commits on Mar 12, 2024

  1. Remove newline under frozen string comment

    To be consistent with the rest of the codebase.
    davishmcclurg committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    9321f1a View commit details
    Browse the repository at this point in the history
  2. Compare property default instance locations by id

    The keys used to collect property defaults are mutable hashes, which
    causes weird hash table problems when they're modified (`#hash` no
    longer matches even though they have the same `#object_id`).
    Explained here: https://docs.ruby-lang.org/en/3.3/Hash.html#class-Hash-label-Modifying+an+Active+Hash+Key
    
    I think this problem got covered up a bit because it requires more than
    8 keys for values to be dropped.
    
    `compare_by_identity` fixes things by just using `#object_id` to compare
    hash keys. It stays consistent after the hash key is mutated.
    
    From the [docs][0]:
    
    > Note: this requirement does not apply if the Hash uses
    > `compare_by_identity` since comparison will then rely on the keys'
    > object id instead of `hash` and `eql?`.
    
    Fixes: #179
    
    [0]: https://docs.ruby-lang.org/en/3.3/Hash.html#class-Hash-label-User-Defined+Hash+Keys
    davishmcclurg committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    b92e1c2 View commit details
    Browse the repository at this point in the history