From 40a39520a6847cee72a1f09473cc0ee61c964241 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 24 May 2024 19:36:21 +0900 Subject: [PATCH] Add tests for issues #95, #97, and #98 to v2 branch Co-Authored-by: Peter Wagenet --- scenario/known-issues/constant-path.rb | 43 ++++++++++++++++++++++++++ scenario/known-issues/struct.rb | 20 ++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 scenario/known-issues/constant-path.rb create mode 100644 scenario/known-issues/struct.rb diff --git a/scenario/known-issues/constant-path.rb b/scenario/known-issues/constant-path.rb new file mode 100644 index 000000000..c492abae4 --- /dev/null +++ b/scenario/known-issues/constant-path.rb @@ -0,0 +1,43 @@ +## update: test.rb +module Baz + module Foo + class Bar < ::Foo::Bar + end + end +end + +module Foo + class Bar + end +end + +## assert: test.rb +module Baz + module Foo + class Bar < ::Foo::Bar + end + end +end + +module Foo + class Bar + end +end + +## update: test.rb +class Foo +end + +module Bar + class Foo < Foo + end +end + +## assert: test.rb +class Foo +end + +module Bar + class Foo < ::Foo + end +end diff --git a/scenario/known-issues/struct.rb b/scenario/known-issues/struct.rb new file mode 100644 index 000000000..5f3119909 --- /dev/null +++ b/scenario/known-issues/struct.rb @@ -0,0 +1,20 @@ +## update: test.rb +Foo = Struct.new(:foo) do + def foo? + !!foo + end + + private + + def not_foo? + !foo + end +end + +## assert: test.rb +class Foo < Struct[untyped] + def foo: -> untyped + def foo?: -> bool + private + def not_foo?: -> bool +end