Skip to content

evalv3: disjunction behavior / disjunction is introduced by evalv3 #3894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mccurdyc opened this issue Apr 17, 2025 · 1 comment
Open

evalv3: disjunction behavior / disjunction is introduced by evalv3 #3894

mccurdyc opened this issue Apr 17, 2025 · 1 comment
Assignees
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@mccurdyc
Copy link

mccurdyc commented Apr 17, 2025

cue version
cue version v0.13.0-alpha.3

go version go1.24.1
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.13.0

old evaluator

CUE_EXPERIMENT=evalv3=0 cue eval -e out minimal.cue
{
    b: value: "true"
} | {
    b: {
        value: "true"
    }
}

evalv3

CUE_EXPERIMENT=evalv3=1 cue eval -e out minimal.cue
{} | {
    b: {
        value: "true"
    }
}

If you have the following scenario:

  1. a disjoint (#oneof https://cuetorials.com/patterns/fields/#oneof) where option "b" is NOT just a string --- string seems to work.
  2. there is a conditional involved
// minimal.cue
package playground

out: {a?: string} | {b?: {value: string}}
out: {
	if true == true {
		b: {value: "true"}
	}
}
@mccurdyc mccurdyc added NeedsInvestigation Triage Requires triage/attention labels Apr 17, 2025
@mccurdyc mccurdyc changed the title evalv3: mismatched disjunction behavior leading to a bug (where a disjunction is INTRODUCED) evalv3: disjunction behavior leading to a bug (where a disjunction is INTRODUCED) Apr 17, 2025
@mccurdyc mccurdyc changed the title evalv3: disjunction behavior leading to a bug (where a disjunction is INTRODUCED) evalv3: disjunction behavior leading to a bug (where a disjunction is INTRODUCED by evalv3) Apr 17, 2025
@mccurdyc
Copy link
Author

mccurdyc commented Apr 17, 2025

Above is the minimal case, but this is closer to the actual behavior we want / have in our code

// minimal.cue
package playground

#Output: {a?: string} | {b?: {value: string}}
out: #Output
out: {
	if true == true {
		b: {value: "true"}
	}
}
CUE_EXPERIMENT=evalv3=0 cue eval -e out minimal.cue
b: {
    value: "true"
}

CUE_EXPERIMENT=evalv3=1 cue eval -e out minimal.cue
{} | {
    b: {
        value: "true"
    }
}

@mccurdyc mccurdyc changed the title evalv3: disjunction behavior leading to a bug (where a disjunction is INTRODUCED by evalv3) evalv3: disjunction behavior / disjunction is introduced by evalv3 Apr 17, 2025
@mvdan mvdan self-assigned this Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

2 participants