diff --git a/lib/typeprof/core/type.rb b/lib/typeprof/core/type.rb index 5450608a..7ddf8634 100644 --- a/lib/typeprof/core/type.rb +++ b/lib/typeprof/core/type.rb @@ -48,7 +48,7 @@ def self.collect_hash_value_types(type) def self.default_param_map(genv, ty) ty = ty.base_type(genv) - instance_ty = ty.is_a?(Type::Instance) ? ty : Type::Instance.new(genv, ty.mod, []) # TODO: type params + instance_ty = ty.is_a?(Type::Instance) ? ty : ty.get_instance_type(genv) singleton_ty = ty.is_a?(Type::Instance) ? Type::Singleton.new(genv, ty.mod) : ty { "*self": Source.new(ty), diff --git a/scenario/rbs/instance-type.rb b/scenario/rbs/instance-type.rb new file mode 100644 index 00000000..aa8cc504 --- /dev/null +++ b/scenario/rbs/instance-type.rb @@ -0,0 +1,25 @@ +## update: test.rbs +class Gen[T] + def self.create: () -> instance +end + +type gen[T] = Gen[T] + +class Object + def accept: (gen[Integer]) -> String +end + +## update: test.rb +def test + accept(Gen.create) +end + +def raw + Gen.create +end + +## assert +class Object + def test: -> String + def raw: -> Gen[untyped] +end