Skip to content

Commit

Permalink
Merge pull request #30 from ruby/instance_type_bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ima1zumi authored Dec 8, 2024
2 parents ff75598 + 01d02c8 commit 237ebf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/repl_type_completor/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ def self.from_rbs_type(return_type, self_type, extra_vars = {})
self_type.transform do |type|
if type.is_a?(SingletonType) && type.module_or_class.is_a?(Class)
InstanceType.new type.module_or_class
elsif type.is_a?(InstanceType)
InstanceType.new type.klass
else
OBJECT
end
Expand Down
5 changes: 5 additions & 0 deletions test/repl_type_completor/test_type_analyze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -719,5 +719,10 @@ def test_rbs_untyped_function
# Proc#call `(?) -> untyped` is RBS::Types::UntypedFunction
assert_call('proc{}.call; 1.', include: Integer)
end

def test_rbs_instance_type
assert_call('Thread.start{}.', include: Thread)
assert_call('"".encode("utf-8").', include: String)
end
end
end

0 comments on commit 237ebf2

Please sign in to comment.