Skip to content

Commit

Permalink
Remove identity comparison feature check in favour of a conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Dec 18, 2023
1 parent d67c001 commit 7645631
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 3 additions & 6 deletions lib/tapioca/gem/listeners/sorbet_signatures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,9 @@ def compile_signature(signature, parameters)
sig { params(signature: T.untyped).returns(T::Boolean) }
def signature_final?(signature)
modules_with_final = T::Private::Methods.instance_variable_get(:@modules_with_final)
final_methods = if sorbet_supports?(:identity_comparison)
modules_with_final[signature.owner]
else
modules_with_final[signature.owner.object_id]
end

# In https://github.com/sorbet/sorbet/pull/7531, Sorbet changed internal hashes to be compared by identity,
# starting on version 0.5.11155
final_methods = modules_with_final[signature.owner] || modules_with_final[signature.owner.object_id]
return false unless final_methods

final_methods.include?(signature.method_name)
Expand Down
1 change: 0 additions & 1 deletion lib/tapioca/helpers/sorbet_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module SorbetHelper
# feature_name: ::Gem::Requirement.new(">= ___"), # https://github.com/sorbet/sorbet/pull/___
non_generic_weak_map: ::Gem::Requirement.new(">= 0.5.10587"), # https://github.com/sorbet/sorbet/pull/6610
generic_class: ::Gem::Requirement.new(">= 0.5.10820"), # https://github.com/sorbet/sorbet/pull/6781
identity_comparison: ::Gem::Requirement.new(">= 0.5.11155"), # https://github.com/sorbet/sorbet/pull/7531
}.freeze,
T::Hash[Symbol, ::Gem::Requirement],
)
Expand Down

0 comments on commit 7645631

Please sign in to comment.