Skip to content

Commit

Permalink
Merge pull request #533 from pocke/_prototype_runtime__Remove_overwri…
Browse files Browse the repository at this point in the history
…table__Class_to_s__call

[prototype runtime] Remove overwritable `Class#to_s` call
  • Loading branch information
pocke authored Dec 19, 2020
2 parents 067c357 + 811b889 commit 97fbad9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rbs/prototype/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def generate_constants(mod)
location: nil
)
else
Types::ClassInstance.new(name: to_type_name(value.class.to_s), args: [], location: nil)
Types::ClassInstance.new(name: to_type_name(const_name(value.class)), args: [], location: nil)
end

@decls << AST::Declarations::Constant.new(
Expand Down
8 changes: 8 additions & 0 deletions test/rbs/runtime_prototype_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,13 @@ def self.to_s() 'FakeToS' end

class C
def self.name() 'FakeNameC' end
def self.to_s() 'FakeToS2' end
include M

INSTANCE = C.new
end


class C2 < C
end
end
Expand All @@ -246,8 +250,12 @@ class RBS::RuntimePrototypeTest::TestForOverrideModuleName::C
include M
def self.name: () -> untyped
def self.to_s: () -> untyped
end
RBS::RuntimePrototypeTest::TestForOverrideModuleName::C::INSTANCE: RBS::RuntimePrototypeTest::TestForOverrideModuleName::C
class RBS::RuntimePrototypeTest::TestForOverrideModuleName::C2 < RBS::RuntimePrototypeTest::TestForOverrideModuleName::C
end
Expand Down

0 comments on commit 97fbad9

Please sign in to comment.