This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/eval: fix Evaluator sync bug
Environment was not set up for correct usage in two cases. For Let expressions, it just happend to always end up at the correct node in the tests before. For relNode, this was only exposed for discontinuous evaluations, which are actually quite rare. Also, added a bit more aggressive error reporting for list comprehensions. Change-Id: Iba14b539a9f84a2960c3170afe68acbeb93ae1ec Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6681 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org> Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
- Loading branch information
Showing
8 changed files
with
363 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- in.cue -- | ||
|
||
a: [{a: 1}, {b: 2 & 3}] | ||
|
||
b: [ for x in a { x } ] | ||
-- out/eval -- | ||
Errors: | ||
a.1.b: incompatible values 3 and 2 | ||
|
||
Result: | ||
(_|_){ | ||
// [eval] | ||
a: (_|_){ | ||
// [eval] | ||
0: (struct){ | ||
a: (int){ 1 } | ||
} | ||
1: (_|_){ | ||
// [eval] | ||
b: (_|_){ | ||
// [eval] a.1.b: incompatible values 3 and 2 | ||
} | ||
} | ||
} | ||
b: (_|_){ | ||
// [eval] a.1.b: incompatible values 3 and 2 | ||
} | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
a: [ | ||
{ | ||
a: 1 | ||
}, | ||
{ | ||
b: (2 & 3) | ||
}, | ||
] | ||
b: [ | ||
for _, x in 〈0;a〉 { | ||
〈1;x〉 | ||
}, | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
This test tests a case where a child node needs to be evaluated | ||
before evaluating a parent has completed. | ||
|
||
-- in.cue -- | ||
a: [ for c in foo.bar.baz { | ||
c | ||
}] | ||
|
||
a: [{name: "http"}] | ||
|
||
foo: { | ||
x.D | ||
|
||
bar: baz: [{port: 8080}] | ||
} | ||
|
||
x: { | ||
D: bar: DSpec | ||
DSpec: {} | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
a: [ | ||
for _, c in 〈0;foo〉.bar.baz { | ||
〈1;c〉 | ||
}, | ||
] | ||
a: [ | ||
{ | ||
name: "http" | ||
}, | ||
] | ||
foo: { | ||
〈1;x〉.D | ||
bar: { | ||
baz: [ | ||
{ | ||
port: 8080 | ||
}, | ||
] | ||
} | ||
} | ||
x: { | ||
D: { | ||
bar: 〈1;DSpec〉 | ||
} | ||
DSpec: {} | ||
} | ||
} | ||
-- out/eval -- | ||
(struct){ | ||
a: (#list){ | ||
0: (struct){ | ||
port: (int){ 8080 } | ||
name: (string){ "http" } | ||
} | ||
} | ||
foo: (struct){ | ||
bar: (struct){ | ||
baz: (#list){ | ||
0: (struct){ | ||
port: (int){ 8080 } | ||
} | ||
} | ||
} | ||
} | ||
x: (struct){ | ||
D: (struct){ | ||
bar: (struct){ | ||
} | ||
} | ||
DSpec: (struct){ | ||
} | ||
} | ||
} |
Oops, something went wrong.