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
3 changes: 3 additions & 0 deletions lib/error_highlight/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,9 @@ def prism_spot_call_for_name
# foo 42
# ^^
def prism_spot_call_for_args
# Disallow highlighting arguments if there are no arguments.
return if @node.arguments.nil?

# Explicitly turn off foo.() syntax because error_highlight expects this
# to not work.
return nil if @node.name == :call && @node.message_loc.nil?
Expand Down
9 changes: 9 additions & 0 deletions test/test_error_highlight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ def test_CALL_arg_6
end
end

def test_CALL_arg_7
assert_error_message(ArgumentError, <<~END) do
tried to create Proc object without a block (ArgumentError)
END

Proc.new
end
end

def test_QCALL_1
assert_error_message(NoMethodError, <<~END) do
undefined method `foo' for #{ ONE_RECV_MESSAGE }
Expand Down