aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-08-31 16:49:16 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-08-31 20:30:27 +0900
commit53ba9fb74ec57c18c3589e2e51f84a36467e3d9e (patch)
treea2cad39cc4cf418580b38c580a7a5940490d60da /parse.y
parent86737c509cd49cfe4509a65d300d390da0f07be6 (diff)
downloadruby-53ba9fb74ec57c18c3589e2e51f84a36467e3d9e.tar.gz
Prohibit setter method names in endless method definition
https://bugs.ruby-lang.org/issues/16746#note-26
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y3
1 files changed, 3 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 4efbd8c6d4..83e6d20ea6 100644
--- a/parse.y
+++ b/parse.y
@@ -2474,6 +2474,9 @@ arg : lhs '=' arg_rhs
}
| defn_head f_paren_args '=' arg
{
+ if (is_attrset_id($<node>1->nd_mid)) {
+ yyerror1(&@1, "setter method cannot be defined in an endless method definition");
+ }
token_info_drop(p, "def", @1.beg_pos);
restore_defun(p, $<node>1->nd_defn);
/*%%%*/