-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue: adjust Environment for comprehensions
Not doing so could result in bad dereferences. CL https://cuelang.org/cl/529517 introduced a way to access the expression associated with a comprehension. In cases where this expression was evaluated within the original Environment of the Comprehension, this resulted in a panic due to an unaligned Environment. The problem was that this value expression needed to be evaluated using an adjusted Environment that accounts for the interstitial scopes introduced by the for and let clauses. In general, these scopes cannot be added ahead of time, as the associated values are not known before evaluation. Like is done in other parts of the code, the new EnvExpr method and function adjusts the Environment by inserting dummy scopes that allow references in the expression that reference values outside of the comprehension to be resolved properly. The old Expr method and function are retained for use cases that only need to refer to the value expression without the need to evaluate or resolve it. Closes #2911 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ibecd4738115456d408f6c7eb505fd00c66e9d3f0 Dispatch-Trailer: {"type":"trybot","CL":1186144,"patchset":2,"ref":"refs/changes/44/1186144/2","targetBranch":"master"}
- Loading branch information
Showing
6 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters