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.
When compiling code such as the following:
The correct output should be roughly equivalent to
print a.b.c
. However, this is not the case, and moonc bombs with an error when code like this is run, even in the presence of a suitable table structure (so thata.b.c
is defined).This is because moonc currently compiles the above snippet into this (note the
_with_1.b
part):This happens because when the transformer emits the
_with_1
assignment,scope_var
(which is used by values to look up the current scope when the short-dot syntax is used) has already been set to the new one (from the nested block). This fix simply reorders thescope_var
assignment so that it happens after these statements have been emitted, so the correct scope is being used.This PR fixes #187 (and #197, its dupe).