Skip to content

evaluator: incomplete errors hide permanent errors #2393

@rogpeppe

Description

@rogpeppe

What version of CUE are you using (cue version)?

$ cue version
cue version v0.0.0-20230428121230-80d6ea032057

go version devel go1.21-3ed8a1e629 Tue Mar 28 05:41:44 2023 +0000
      -buildmode exe
       -compiler gc
  DefaultGODEBUG panicnil=1
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
             vcs git
    vcs.revision 80d6ea032057b40e405eefab6015e92bbc5cc2a5
        vcs.time 2023-04-28T12:12:30Z
    vcs.modified false

Does this issue reproduce with the latest stable release?

What did you do?

! exec cue vet -c=false x.cue

-- x.cue --
x: int
y: int
z: x+y
z: string

What did you expect to see?

Passing test.

What did you see instead?

> ! exec cue vet -c=false x.cue
FAIL: /tmp/testscript4064544029/x.txtar/script.txtar:1: unexpected command success

Even though the evaluator could statically tell that the result of int + int is int, regardless of the inputs, so cannot unify with string, the incomplete error causes it to drop all further type checking.

This is a real problem when checking configurations with deliberate incompleteness that will be filled in later in some other evaluation context. It would be much better to fail early in this kind of scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions