From: "eightbitraptor (Matt V-H) via ruby-core" Date: 2026-11-27T19:32:48+00:00 Subject: [ruby-core:127752] [Ruby Bug#22619] parse.y missing invalid return syntax error Issue #22619 has been updated by eightbitraptor (Matt V-H). Backport PRs: * ruby_3_4: https://github.com/ruby/ruby/pull/20231 * ruby_4_0: https://github.com/ruby/ruby/pull/20232 ---------------------------------------- Bug #22619: parse.y missing invalid return syntax error https://bugs.ruby-lang.org/issues/22619#change-120300 * Author: kddnewton (Kevin Newton) * Status: Closed * Backport: 3.3: DONTNEED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- ``` $ ./ruby --parser=parse.y -ce 'class C; return; end' -e:1: Invalid return in class/module body class C; return; end ./ruby: compile error (SyntaxError) $ ./ruby --parser=parse.y -ce 'class C; def f; end; return; end' Syntax OK ``` and ``` $ ./ruby --parser=parse.y -e 'class C; return; end' -e:1: Invalid return in class/module body class C; return; end ./ruby: compile error (SyntaxError) $ ./ruby --parser=parse.y -e 'class C; def f; end; return; end' -e:1:in '': unexpected return (LocalJumpError) from -e:1:in '
' ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/