Isolates local variable resolution logic #1344
Merged
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.
Description
While working towards unifying our resolution logic for catalog identifiers, I began cleaning up the Env.kt. This cleans up local resolution (isolating all logic to TypeEnv for easy testing). It also appropriately prioritizes known schema matches over open schema matches (known vs not known).
This matches what is defined in our specification for locals resolution, but there's a possible extension to discuss. We may consider matching longest locals paths. If you read p38 carefully, it indicates we only match the path root for locals (that's what in this PR) — but I believe we should consider matching longest local variable paths as well.
Other Information
Updated Unreleased Section in CHANGELOG: [YES/NO]
No
Any backward-incompatible changes? [YES/NO]
No
Any new external dependencies? [YES/NO]
No
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
Yes
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.