Skip to content

evalv2: strings.Join swallow compilation error #3567

@davireis

Description

@davireis

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

cue version v0.10.0

go version go1.23.0
      -buildmode exe
       -compiler gc
        -ldflags -s -w -X cuelang.org/go/cmd/cue/cmd.version=v0.10.0
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
         GOARM64 v8.0
             vcs git
    vcs.revision a7c37ee1eeb84546552bcc70aa280ab7c748e9e9
        vcs.time 2024-08-14T21:53:19Z
    vcs.modified false
cue.lang.version v0.10.0

Does this issue reproduce with the latest stable release?

Yes

What did you do?

Notice the missing second parameter in the nested strings.Join call.

echo 'import "strings"' > f1.cue
echo 'a: strings.Join( [ strings.Join(["1"]), "2" ], "\n")' >> f1.cue
cue eval f1.cue
a: "2"

What did you expect to see?

if I extract the strings.Join from the nested context I get the right error.

echo 'import "strings"' > f2.cue
echo '_a: strings.Join(["1"])' >> f2.cue
echo 'a: strings.Join( [ _a, "2" ], "\n")' >> f2.cue
cue eval f2.cue
_a: not enough arguments in call to strings.Join (have 1, want 2):
    ./f2.cue:2:5

What did you see instead?

I saw an incorrect output with no error signaling, which is hard to track down in an extensive configuration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions