Skip to content

Commit

Permalink
successfully hacking tapioca generic
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrias committed Sep 10, 2024
1 parent 60f6aa8 commit 97faa36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/runtime_generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ def [](inner_type)
end

def type_member(variance = :invariant, &blk)
if defined?(Tapioca)
if defined?(Tapioca::TypeVariableModule)
puts 'Patching tapioca inference'
# `T::Generic#type_member` just instantiates a `T::Type::TypeMember` instance and returns it.
# We use that when registering the type member and then later return it from this method.
Tapioca::TypeVariableModule.new(
return Tapioca::TypeVariableModule.new(
T.cast(self, Module),
Tapioca::TypeVariableModule::Type::Member,
variance,
Expand Down

0 comments on commit 97faa36

Please sign in to comment.