-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/trim: optional fields should not remove non-optional
The solution is rather brute-force, we need to find something more fine-grained eventually. But for now this avoids an erroneous removal. Fixing this will be easier when optional fields are represented as normal fields with an optional flag, as they were in v0.2. Fixes #855 Change-Id: I65829858b1856fcd09aa121f1e1c53fd49864c87 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9221 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
- Loading branch information
Showing
2 changed files
with
55 additions
and
7 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,37 @@ | ||
// Optional fields should retain status after removal of unified | ||
// content. | ||
|
||
// Issue #855 | ||
|
||
-- cue.mod/module.cue -- | ||
module: "mod.com" | ||
-- a.cue -- | ||
package pkg | ||
|
||
a: [...#A] | ||
|
||
a: [{ | ||
annotations: {} | ||
}] | ||
|
||
#A: annotations?: [string]: string | ||
|
||
b: #B | ||
b: bb: c: 2 // c can be removed, bb not. | ||
#B: bb?: c: 2 | ||
|
||
-- out/trim -- | ||
== a.cue | ||
package pkg | ||
|
||
a: [...#A] | ||
|
||
a: [{ | ||
annotations: {} | ||
}] | ||
|
||
#A: annotations?: [string]: string | ||
|
||
b: #B | ||
b: bb: {} // c can be removed, bb not. | ||
#B: bb?: c: 2 |
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