Module: T::Utils::Private::TapiocaGenericTypeCoercePatch

Included in:
T::Utils::Private
Defined in:
lib/tapioca/sorbet_ext/generic_type_patch.rb

Overview

Preserve Tapioca’s generic type variables and instantiated generic names when Sorbet coerces them into runtime types.

Instance Method Summary collapse

Instance Method Details

#coerce_and_check_module_types(val, check_val, check_module_type) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/tapioca/sorbet_ext/generic_type_patch.rb', line 10

def coerce_and_check_module_types(val, check_val, check_module_type)
  if val.is_a?(Tapioca::TypeVariableModule)
    val.coerce_to_type_variable
  elsif val.respond_to?(:__tapioca_override_type)
    val.__tapioca_override_type
  else
    super
  end
end