< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #13005 has been updated by Yukihiro Matsumoto.
Status changed from Open to Closed
```
o.a = 1 rescue $!.class
```
is parsed as
```
o.a = (1 rescue $!.class)
```
Try
```
(o.a = 1) rescue $1.class
```
Matz.
----------------------------------------
Bug #13005: Inline rescue is inconsistent when rescuing NoMethodError
https://bugs.ruby-lang.org/issues/13005#change-61868
* Author: Josh Cheek
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.4.0dev (2016-11-16 trunk 56815) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```ruby
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>'
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>