-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/buildattr: stop at package clause and support parentheses
The existing logic was not behaving as expected: it did not stop when it encountered a `package` clause. Also, the expressions did not support parentheses, which seems like an oversight: it's much less useful to have `&&` and `!` operators if it's not possible to group subexpressions. Fixes #3228. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ifed4419f4c89b6d52389c06aa960563e3f045a87 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197530 Reviewed-by: Paul Jolly <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
19 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,31 @@ | ||
# This verifies that evaluation of build attributes is not order-dependent. | ||
|
||
! exec cue export | ||
cmp stderr error | ||
|
||
exec cue export -t C | ||
cmp stdout out | ||
|
||
exec cue export -t A -t B | ||
cmp stdout out | ||
|
||
exec cue export -t A -t C | ||
cmp stdout out | ||
|
||
exec cue export -t B -t C | ||
cmp stdout out | ||
|
||
exec cue export -t A -t B -t C | ||
cmp stdout out | ||
-- example.cue -- | ||
@if( A && B || C ) | ||
package example | ||
|
||
x: 1 | ||
-- out -- | ||
{ | ||
"x": 1 | ||
} | ||
-- error -- | ||
build constraints exclude all CUE files in .: | ||
script-issue3228/example.cue: @if( A && B || C ) did not match |
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