[ruby/error_highlight] Fix the spurious TypeError.
When we have no backtrace locations, we can't have the highlight, so just return the message. https://github.com/ruby/error_highlight/commit/9f5c639494
This commit is contained in:
parent
e22218b510
commit
11b1ebe606
@ -15,6 +15,7 @@ module ErrorHighlight
|
|||||||
return msg unless locs
|
return msg unless locs
|
||||||
|
|
||||||
loc = locs.first
|
loc = locs.first
|
||||||
|
return msg unless loc
|
||||||
begin
|
begin
|
||||||
node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
|
node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
|
||||||
opts = {}
|
opts = {}
|
||||||
|
@ -1198,9 +1198,6 @@ undefined method `time' for 1:Integer
|
|||||||
def test_simulate_funcallv_from_embedded_ruby
|
def test_simulate_funcallv_from_embedded_ruby
|
||||||
assert_error_message(NoMethodError, <<~END) do
|
assert_error_message(NoMethodError, <<~END) do
|
||||||
undefined method `foo' for nil:NilClass
|
undefined method `foo' for nil:NilClass
|
||||||
|
|
||||||
nil.foo + 1
|
|
||||||
^^^^
|
|
||||||
END
|
END
|
||||||
|
|
||||||
nil.foo + 1
|
nil.foo + 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user