Skip to content
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

evalv3: "explicit error in source" regression when using bottom in repeating disjunctions #3599

Open
mvdan opened this issue Nov 27, 2024 · 1 comment
Labels
evaluator evalv3 issues affecting only the evaluator version 3

Comments

@mvdan
Copy link
Member

mvdan commented Nov 27, 2024

# With the old evaluator.
env CUE_EXPERIMENT=evalv3=0
exec cue vet -c=false

# With the new evaluator.
env CUE_EXPERIMENT=evalv3=1
exec cue vet -c=false

-- input.cue --
package p

#Action: {
	action: {
		read!:  string
		write?: _|_
	} | {
		write!: string
		read?:  _|_
	}
}

#Minio: {
	container: #Action & {
		action: {
			read!:  string
			write?: _|_
		} | {
			write!: string
			read?:  _|_
		}
	}
	doWrite: bool | *true
	container: action: defaultAction
	defaultAction: {
		if doWrite { write: "somefile.txt" }
		if !doWrite { read: "somefile.txt" }
	}
}

As of c29fd02:

# With the old evaluator. (0.010s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue vet -c=false
# With the new evaluator. (0.027s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue vet -c=false
[stderr]
explicit error (_|_ literal) in source:
    ./input.cue:17:12
explicit error (_|_ literal) in source:
    ./input.cue:20:12
[exit status 1]

This seems like a straight up regression to me. Note that the original source used regular fields in place of required fields, but the regression reproduces with either of them, and required fields are the more appropriate here I think.

@mpvl
Copy link
Member

mpvl commented Nov 29, 2024

Simplified reproducer:

{ a?:  _|_ } | { a:  string, b?: _|_ }
{ a?:  _|_ } | { a:  string }
if false { a: "x" }

(with help of the graphical CUE debugger that showed quite quickly where the problem lies.)

@mvdan mvdan added the evalv3 issues affecting only the evaluator version 3 label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluator evalv3 issues affecting only the evaluator version 3
Projects
None yet
Development

No branches or pull requests

2 participants