rule actions cannot be typed

Make sure that we cannot apply a type to the (main) action of a rule.

* src/reader.c (grammar_rule_check): Issue the warning.
* tests/input.at (Cannot type action): Check the warning.
This commit is contained in:
Akim Demaille
2018-08-05 10:42:15 +02:00
parent f18f71cfb0
commit da8f4a2f5f
2 changed files with 26 additions and 1 deletions

View File

@@ -2193,7 +2193,7 @@ input.y:13.11-21: previous definition
AT_CLEANUP
##--------------------------- ##
## -------------------------- ##
## Non-deprecated directives. ##
## -------------------------- ##
@@ -2224,3 +2224,23 @@ AT_BISON_CHECK([[input.y]], [[0]], [[]],
]])
AT_CLEANUP
## -------------------- ##
## Cannot type action. ##
## -------------------- ##
AT_SETUP([[Cannot type action]])
AT_DATA_GRAMMAR([[input.y]],
[[%%
exp: <int> {}
]])
AT_BISON_CHECK([[-fcaret input.y]], [[0]], [[]],
[[input.y:10.6-13: warning: only midrule actions can be typed: int [-Wother]
exp: <int> {}
^^^^^^^^
]])
AT_CLEANUP