File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ def full_name_parts
118
118
current = current . parent
119
119
end
120
120
121
- unless current . is_a? ( ConstantReadNode )
121
+ unless current . is_a? ( ConstantReadNode ) || current == nil
122
122
raise DynamicPartsInConstantPathError , "Constant path contains dynamic parts. Cannot compute full name"
123
123
end
124
124
Original file line number Diff line number Diff line change @@ -52,5 +52,16 @@ def test_full_name_for_constant_path_target
52
52
node = Prism . parse ( source ) . value . statements . body . first
53
53
assert_equal ( "Foo::Bar::Baz::Qux" , node . lefts . first . full_name )
54
54
end
55
+
56
+ def test_full_name_for_constant_path_with_stovetop_start
57
+ source = <<~RUBY
58
+ ::Foo:: # comment
59
+ Bar::Baz::
60
+ Qux, Something = [1, 2]
61
+ RUBY
62
+
63
+ node = Prism . parse ( source ) . value . statements . body . first
64
+ assert_equal ( "::Foo::Bar::Baz::Qux" , node . lefts . first . full_name )
65
+ end
55
66
end
56
67
end
You can’t perform that action at this time.
0 commit comments