Defer generating labels in the automaton to prevent duplicate labels being generated #105
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.
The generated code for
@match_return
and@match_fail
produce labels in the generated code. However, the code for patterns may be repeated, and code that contains these constructs is rewritten as part of the pattern. Consequently, these constructs can end up generating code with duplicate labels. To prevent that, we defer generating the label until the code is generated, so each copy of it will get a distinct label.The first commit makes a couple of changes that are just refactorings to simplify things.
The second commit fixes the bug.
You will probably find it easier to review the two commits separately.
Fixes: #102