-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core/adt: correct copying of conjuncts in stripNonDefaults
If Conjunct.x is a ConjunctGroup, then Conjunct.Expr() may return an expression which is a distant descendent. And then we have no way of obtaining the correct Env for the expr which we need in stripNonDefaults(). StripNonDefaults should duplicate the tree of conjuncts and conjunct groups faithfully, so it is simpler to clone the current ConjunctGroup and then update the x's with stripped versions of each conjunct's Elem (which does not behave in the same way as the Conjunct.Expr()). Fixes: #3718 Signed-off-by: Matthew Sackman <matthew@cue.works> Change-Id: I7dd5c23cad4c9b4d7453c7c8d6de9cc9e07a7f92 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1209119 Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information
1 parent
9413ce6
commit 15a702e
Showing
4 changed files
with
41 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ( | ||
"encoding/json" | ||
) | ||
|
||
let defaultPolicy = json.Marshal({ deny: "all" }) | ||
|
||
#Spec: { | ||
policy?: string | *defaultPolicy | ||
} |
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,21 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Generated by cue.", | ||
"version": "no version" | ||
}, | ||
"paths": {}, | ||
"components": { | ||
"schemas": { | ||
"Spec": { | ||
"type": "object", | ||
"properties": { | ||
"policy": { | ||
"type": "string", | ||
"default": "{\"deny\":\"all\"}" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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