foobar.rb:24: warning: duplicated when clause is ignored
I would like to see:
foobar.rb:24: warning: duplicated when clause 'foo' is ignored.
This way, I can scan through the file with the case/when structure
and correct this error. But right now, if you have a very long
case/when structure, you have no idea WHICH clause is duplicated.
The warning message just vaguely says that there is, and this is
not very helpful information.
case nil
when 1
when 1, 1
when 1, 1, 1, 1
when 1, 1
end
#=>
../trunk/test.rb:1: warning: duplicated when clause (#1) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#2) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#3) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#4) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#5) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#6) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#7) is ignored
../trunk/test.rb:1: warning: duplicated when clause (#8) is ignored
foobar.rb:24: warning: duplicated when clause is ignored
I would like to see:
foobar.rb:24: warning: duplicated when clause 'foo' is ignored.
This way, I can scan through the file with the case/when structure
and correct this error. But right now, if you have a very long
case/when structure, you have no idea WHICH clause is duplicated.
The warning message just vaguely says that there is, and this is
not very helpful information.
This issue was solved with changeset r35277.
markus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
compile.c (iseq_set_sequence): show a hint if there are duplicated
"when" clauses. [ruby-core:41502] [ruby-trunk - Feature #5716]