meaning that an alternative between two rules/parsers that have the same attribute type will have an attribute that is the same as that common type (instead of a variant of the individual types).
However, this is not the case. Alternatives such as the above still result in an attribute of type variant< A, A >.
While (I think?) automatic propagation rules can correctly propagate this to an attribute of type A, this is a problem/inconvenience for e.g. semantic actions as they get the immediate attribute type and thus have to work with the variant.
The docs state
meaning that an alternative between two rules/parsers that have the same attribute type will have an attribute that is the same as that common type (instead of a variant of the individual types).
However, this is not the case. Alternatives such as the above still result in an attribute of type
variant< A, A >
.While (I think?) automatic propagation rules can correctly propagate this to an attribute of type
A
, this is a problem/inconvenience for e.g. semantic actions as they get the immediate attribute type and thus have to work with the variant.MWE (Godbolt):