Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/typeprof/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,14 @@ def import(explicit = false)
members = cdef[:members]

name = classpath.last
superclass = path_to_klass(superclass) if superclass
if superclass
if superclass == classpath
# Remove the second to last element so that lookup happens in the parent
superclass = superclass.dup
superclass.delete_at(-2)
end
superclass = path_to_klass(superclass)
end
base_klass = path_to_klass(classpath[0..-2])

klass, = @scratch.get_constant(base_klass, name)
Expand Down
4 changes: 4 additions & 0 deletions smoke/rbs-matching-superclass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Foo
end
__END__
# Classes
7 changes: 7 additions & 0 deletions smoke/rbs-matching-superclass.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Foo
end

class Bar
class Foo < Foo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this would look for Bar::Foo instead of ::Foo.

end
end