add check for multiple config decls in one module #4706
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If multiple config declarations appear in one module, it can only even theoretically be well formed if one is supposed to be nested inside the other. However, in order to handle such a case, we would need to parse each one separately, check whether they contain nested declarations, check whether the nesting is acyclic, and then only after doing all that, process each declaration and produce syntax for them. This would be quite complex, however, no additional modularity is added by allowing this because there is no reason not to merge both config declarations into a single one if they are located in the same module.
This didn't work anyway, but the error message you got when this happened was quite unintuitive and it wasn't clear what was going on. So in this PR we add a much friendlier error message for this case to explain why the definition was rejected.