Bug #20409
closedMissing reporting some invalid breaks
Added by kddnewton (Kevin Newton) about 2 years ago. Updated 9 days ago.
Updated by kddnewton (Kevin Newton) about 2 years ago
ยท Edited
Actions
#1
[ruby-core:117435]
Sorry hit enter too soon...
def a
break
rescue
b while c
end
def a
break
ensure
b while c
end
Updated by kddnewton (Kevin Newton) about 2 years ago
Actions
#2
[ruby-core:117436]
I think
END { break }
should also be a syntax error, as it seems to always result in a LocalJumpError, but I could be wrong.
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
Actions
#3
[ruby-core:117439]
It reproduces only with a modifier while/until, even without rescue/ensure.
begin
break
nil while false
end
Updated by Earlopain (Earlopain _) 7 months ago
Actions
#4
[ruby-core:123664]
Today I get a syntax error for all the examples in both parsers except for END { break }. Can this be closed or should END { break } still be considered?
Updated by Earlopain (Earlopain _) 7 months ago
Actions
#5
[ruby-core:123673]
I think END should be syntax error. The same is already true for BEGIN, seems inconsistent.
Updated by kddnewton (Kevin Newton) 7 months ago
Actions
#6
[ruby-core:123674]
I think END { break } should still be a syntax error, as it always results in an error.
Updated by Earlopain (Earlopain _) 7 months ago
Actions
#7
[ruby-core:123702]
I added it to the dev meeting and implemented it in https://github.com/ruby/prism/pull/3707
Updated by matz (Yukihiro Matsumoto) about 1 month ago
Actions
#8
[ruby-core:125299]
Yes, it is OK to make it SyntaxError.
Matz.
Updated by Earlopain (Earlopain _) 25 days ago
Actions
#9
- Status changed from Open to Closed
Applied in changeset git|558c10413990cb08b7750895b572b0b59eed0d28.
[ruby/prism] Reject END { break } for Ruby 4.0
For [Bug #20409]
Updated by kddnewton (Kevin Newton) 25 days ago
Actions
#10
[ruby-core:125365]
- Status changed from Closed to Open
Re-opening, we need a syntax error for parse.y.
Updated by nobu (Nobuyoshi Nakada) 10 days ago
Actions
#11
[ruby-core:125473]
Is it intentional that END {next} is valid, whereas BEGIN {next} is a syntax error?
Updated by nobu (Nobuyoshi Nakada) 10 days ago
Actions
#12
- Status changed from Open to Closed
Applied in changeset git|2f9432d2114833b105577ad72e323990daf5101e.
[Bug #20409] Make break and redo in END syntax error
Updated by matz (Yukihiro Matsumoto) 9 days ago
Actions
#13
[ruby-core:125486]
Not intentional. It is just a leftover from the old implementation. The inconsistency should be fixed eventually.
Matz.
Updated by Earlopain (Earlopain _) 9 days ago
Actions
#14
[ruby-core:125489]
Here it is https://github.com/ruby/ruby/pull/16936 (I did prism and parsey). Makes the implementaion easier to not have to special-case this