< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #11182 has been updated by Shugo Maeda.
Status changed from Closed to Open
Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Bug #11182: Refinement with alias causes strange behavior
https://bugs.ruby-lang.org/issues/11182#change-52650
* Author: Koichi Sasada
* Status: Open
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: 2.3dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
The following script causes strange behavior.
```ruby
class C
def foo
p "C"
end
end
module M
refine C do
def foo
p "Refiend C"
end
end
end
class D < C
alias bar foo
end
using M
D.new.bar
#=> t.rb:21:in `<main>': undefined method `bar' for #<D:0x29fbf58> (NoMethodError)
```
It seems strange.
Maybe (1) C#foo or (2) M#C#foo should be called. But I'm not sure which is suitable.
Previous versions:
```
ruby 2.0.0p606 (2014-11-28 revision 48636) [i386-mswin32_110]
t.rb:9: warning: Refinements are experimental, and the behavior may change in future versions of Ruby!
"C"
ruby 2.1.5p312 (2015-03-10 revision 49912) [i386-mswin32_110]
"C"
```
--
https://bugs.ruby-lang.org/