internal/core/validate: pick up non-concrete values in defaults
Change-Id: I40f555fb997cfc375774d2fa4d8f26d58171e05d
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8284
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/core/validate/validate.go b/internal/core/validate/validate.go
index e1addf4..1af60c4 100644
--- a/internal/core/validate/validate.go
+++ b/internal/core/validate/validate.go
@@ -87,7 +87,7 @@
}
} else if v.checkConcrete() {
- x := x.Default()
+ x = x.Default()
if !adt.IsConcrete(x) {
x := x.Value()
v.add(&adt.Bottom{
diff --git a/internal/core/validate/validate_test.go b/internal/core/validate/validate_test.go
index f23f6fe..e5ed4ff 100644
--- a/internal/core/validate/validate_test.go
+++ b/internal/core/validate/validate_test.go
@@ -163,6 +163,24 @@
c: b + b
}
`,
+ }, {
+ desc: "pick up non-concrete value in default",
+ cfg: &Config{Concrete: true},
+ in: `
+ x: null | *{
+ a: int
+ }
+ `,
+ out: "incomplete\nx.a: incomplete value int",
+ }, {
+ desc: "pick up non-concrete value in default",
+ cfg: &Config{Concrete: true},
+ in: `
+ x: null | *{
+ a: 1 | 2
+ }
+ `,
+ out: "incomplete\nx.a: incomplete value 1 | 2",
}}
r := runtime.New()