From: "kddnewton (Kevin Newton) via ruby-core" Date: 2024-07-23T14:02:39+00:00 Subject: [ruby-core:118670] [Ruby master Bug#20647] Invalid return in class/module body from within singleton class Issue #20647 has been reported by kddnewton (Kevin Newton). ---------------------------------------- Bug #20647: Invalid return in class/module body from within singleton class https://bugs.ruby-lang.org/issues/20647 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Currently, Ruby will raise a syntax error for invalid returns within class and module bodies, but skips it for singleton classes. I think we should be able to add this same error for singleton classes, as I believe these always raise a LocalJumpError. ```ruby class << Object return end ``` -- 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/