Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive in grammar multiple assignments validation #1756

Open
cdietrich opened this issue Nov 20, 2024 · 1 comment
Open

False positive in grammar multiple assignments validation #1756

cdietrich opened this issue Nov 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cdietrich
Copy link
Contributor

Langium version: 3.3

given the grammar

entry Model:
    expr=Expression;

Expression: Equality;

Equality infers Expression:
    Literal (({infer Equals.left=current} '==' | {infer NotEquals.left=current} '!=')  right=Literal)*;

Literal: value=INT;

the validator complains about

src/language/hello-world.langium:9:88 - Found multiple assignments to 'right' with the '=' assignment operator. Consider using '+=' instead to prevent data loss.

imho this is a false positive with the ast rewrite. maybe it is not properly detected if happing on all branches of an alternative.

@cdietrich cdietrich added the bug Something isn't working label Nov 20, 2024
@cdietrich cdietrich changed the title False positive in grammar False positive in grammar multiple assignments validation Nov 20, 2024
@cdietrich
Copy link
Contributor Author

cc @JohannesMeierSE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant