Q: Sorbet generics question - method with type variable in parameter position I'm trying to get this Sorbet code working (here on Sorbet playground):
# typed: true

extend T::Sig
extend T::Generic

class Foo
  extend T::Sig
  extend T::Generic

  TypeParam = type_member
end

class FooA < Foo
  TypeParam = type_member(fixed: Integer)
end

sig {type_parameters(:MyParam)
      .params(foo: Foo[T.type_parameter(:MyParam)]).void}
def blah(foo)
end

my_foo = FooA.new
blah(T.cast(my_foo, Foo[Integer]))

However, I'm getting a type error:
editor.rb:23: Expected Foo[T.type_parameter(:MyParam)] but found Foo[Integer] for argument foo https://srb.help/7002
    23 |blah(T.cast(my_foo, Foo[Integer]))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Expected Foo[T.type_parameter(:MyParam)] for argument foo of method Object#blah:
    editor.rb:18:
    18 |      .params(foo: Foo[T.type_parameter(:MyParam)]).void}
                      ^^^
  Got Foo[Integer] originating from:
    editor.rb:23:
    23 |blah(T.cast(my_foo, Foo[Integer]))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 1

I'm not sure how to monomorphize the blah method so that it can take an argument of type Foo[Integer]. Does Sorbet currently support this use-case?

A: If I understand what you are trying to do correctly, and you want blah to just take an argument of type Foo[Integer], you can do:
sig {params(foo: Foo[Integer]).void}
def blah(foo)
end

You can see a full example (with a type that doesn't conform to the interface here):
class Foo
  extend T::Sig
  extend T::Generic

  TypeParam = type_member
end

class FooA < Foo
  TypeParam = type_member(fixed: Integer)
end

class FooB < Foo
  TypeParam = type_member(fixed: String)
end

sig {params(foo: Foo[Integer]).void}
def blah(foo)
end

my_foo = FooA.new
blah(my_foo)

my_bad_foo = FooB.new
blah(my_bad_foo)

