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

Dependencies from default productions aren't included in flow type inference #820

Open
krame505 opened this issue Nov 17, 2023 · 1 comment · May be fixed by #880
Open

Dependencies from default productions aren't included in flow type inference #820

krame505 opened this issue Nov 17, 2023 · 1 comment · May be fixed by #880
Assignees

Comments

@krame505
Copy link
Member

For example

inherited attribute inh::Integer occurs on Foo;
inherited attribute syn::Integer occurs on Foo;
aspect default production
top::Foo ::=
{ top.syn = top.inh; }

If there are no other equations for syn, this will flag the default equation as exceeding the flow type of syn. As a workaround, one can explicitly specify flowtype syn {inh} on Foo;.

@krame505 krame505 changed the title Dependencies from flow type inference aren't included in flow type inference Dependencies from default productions aren't included in flow type inference Nov 17, 2023
@github-project-automation github-project-automation bot moved this to To do - uncategorized in Hackathon Jan 3, 2025
@krame505 krame505 self-assigned this Jan 14, 2025
@krame505 krame505 moved this from To do to In progress in Hackathon Jan 14, 2025
@krame505
Copy link
Member Author

Note that this isn't quite true - if there are non-forwarding productions that lack an equation for syn, then the dependencies of the default equation for syn will still have an effect. But if all non-forwarding productions have an equation, the flow type for syn will not be inferred to contain inh. This is an unusual situation with regular nonterminals (unless some non-forwarding prods still need to be written that will make use of the default equation), but for closed nonterminals this is a more egregious issue as one would frequently write new non-forwarding productions for the nonterminal in extensions, where the default would apply.

The fix here is to include default production flow graphs in the flow type inference process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

1 participant