Actions
Bug #13005
closedInline rescue is inconsistent when rescuing NoMethodError
Description
o = "some object"
class << o
private
attr_accessor :a
end
# GETTER can be rescued in a begin-block or inline
begin o.a
rescue; $!.class # => NoMethodError
end
o.a rescue $!.class # => NoMethodError
# SETTER can be rescued in a begin-block but NOT inline!
begin o.a = 1
rescue; $!.class # => NoMethodError
end
o.a = 1 rescue $!.class
# ~> NoMethodError
# ~> private method `a=' called for "some object":String
# ~> Did you mean? a
# ~>
# ~> program.rb:18:in `<main>'
Actions
Like0
Like0Like0Like0Like0Like0