Skip to content

Commit

Permalink
internal/core/export: fix export of disjunction with eliminated defaults
Browse files Browse the repository at this point in the history
This was a remnant of old semantics of defaults.

Fixes #950

Change-Id: I282192320c6dd327ace8dbca1cce0f81e88f0534
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9725
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
  • Loading branch information
mpvl committed May 10, 2021
1 parent 5b8ab47 commit cd286a8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
4 changes: 0 additions & 4 deletions internal/core/adt/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ func Default(v Value) Value {
func (d *Disjunction) Default() Value {
switch d.NumDefaults {
case 0:
if d.HasDefaults {
// empty disjunction
return &Bottom{}
}
return d
case 1:
return d.Values[0]
Expand Down
53 changes: 53 additions & 0 deletions internal/core/export/testdata/disjunction.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- in.cue --
// Issue #950
a: *1 | int
b: *2 | int
c: *(a & b) | 3
-- out/definition --
// Issue #950
a: *1 | int
b: *2 | int
c: *(a & b) | 3
-- out/doc --
[]
- Issue #950

[a]
- Issue #950

[b]
[c]
-- out/value --
== Simplified
{
// Issue #950
a: *1 | int
b: *2 | int
c: 1 | 2 | int | 3
}
== Raw
{
// Issue #950
a: *1 | int
b: *2 | int
c: 1 | 2 | int | 3
}
== Final
{
a: 1
b: 2
c: 1 | 2 | int | 3
}
== All
{
// Issue #950
a: *1 | int
b: *2 | int
c: 1 | 2 | int | 3
}
== Eval
{
a: 1
b: 2
c: 1 | 2 | int | 3
}

0 comments on commit cd286a8

Please sign in to comment.