Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
internal/core/validate: pick up non-concrete values in defaults
Browse files Browse the repository at this point in the history
Change-Id: I40f555fb997cfc375774d2fa4d8f26d58171e05d
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8284
Reviewed-by: CUE cueckoo <[email protected]>
Reviewed-by: Marcel van Lohuizen <[email protected]>
  • Loading branch information
mpvl committed Jan 23, 2021
1 parent fdc7010 commit 0f570a9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/core/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (v *validator) validate(x *adt.Vertex) {
}

} else if v.checkConcrete() {
x := x.Default()
x = x.Default()
if !adt.IsConcrete(x) {
x := x.Value()
v.add(&adt.Bottom{
Expand Down
18 changes: 18 additions & 0 deletions internal/core/validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@ y: conflicting values 4 and 2:
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()
Expand Down

0 comments on commit 0f570a9

Please sign in to comment.