-
Notifications
You must be signed in to change notification settings - Fork 346
Description
Consider the following example:
! exec cue vet -c=false x.cue
-- x.cue --
#Y: {
cond!: bool
x!: int
}
y: #Y & {
cond!: bool
if cond {
x: "hello"
}
if !cond {
x: "blah"
}
}
In this example, y represents a template where the condition is not known yet.
Whatever the condition, the result will always be a conflict, because in all cases, the CUE is setting x to a string where it's defined in the schema as an integer.
If this pattern occurs in real-world CUE, it would almost certainly be a mistake that we'd like to catch early.
However cue vet currently succeeds on this example.
I think it would be useful if cue vet was to fail if there is a conflict of this kind - theoretically we know that y is unified with #Y and that the field #Y.x is an int, so any occurrence of x that doesn't unify with int is a likely mistake. That way we could catch more failures early, even in the presence of incomplete results.