Actions
Bug #18884
closedparse.y: inconsistent parsing of "if" after "class"
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
Description
There is a corner case where if
inconsistently causes a syntax error:
# syntax error, unexpected `if' modifier
class if 1; Object end::Object
end
compare the following:
# Parses
module if 1; Object end::Kernel
end
We use EXPR_CLASS
after the class keyword to temporarily disable heredocs as in class <<self; end
. This state is expected to behave like EXPR_BEG in other cases but the above case fails to take it into account.
Actions
Like0
Like0