Module: T::Private::Casts::TapiocaGenericTypeCastPatch

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

Instance Method Summary collapse

Instance Method Details

#cast(value, type, cast_method) ⇒ Object

github.com/sorbet/sorbet/commit/b8d64c7fd9a08e2b9159b5d592bc2de6d586b44a inlines the Module fast path in ‘T.let`, `T.cast`, `T.bind`, and `T.assert_type!`, so generic module clones can reach this cast path without going through `T::Utils::Private::TapiocaGenericTypeCoercePatch`.



34
35
36
37
38
39
40
# File 'lib/tapioca/sorbet_ext/generic_type_patch.rb', line 34

def cast(value, type, cast_method)
  if type.respond_to?(:__tapioca_override_type)
    type = type.__tapioca_override_type
  end

  super(value, type, cast_method)
end