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

Container type computation misses some types #1063

Open
spoenemann opened this issue May 25, 2023 · 0 comments
Open

Container type computation misses some types #1063

spoenemann opened this issue May 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@spoenemann
Copy link
Contributor

Langium version: 2.0.0
Package name: langium

See the discussion here: #1055 (comment)

The current container type computation does not respect unassigned rule calls and actions when it determines a container relationship. In some cases (like the Keyword type of the grammar language) this leads to a container type that is too strict, i.e. it's missing some possible containers.

If this turns out to be a real problem in practice, we could improve the algorithm with something like this:

  1. Traverse the parser rules looking for assigned rule calls. When we find one of the form A: ... b=B ...; we memorize the container A and go to rule B.
  2. Add container A to the target type and all types mentioned by actions in the current rule.
  3. If the current rule has unassigned rule calls, visit all of them by going to step 2. using the unassigned rule as current rule.
@spoenemann spoenemann added the bug Something isn't working label May 25, 2023
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