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

cue def --inline-imports regression in v0.11 #3646

Open
gotwarlost opened this issue Jan 2, 2025 · 3 comments
Open

cue def --inline-imports regression in v0.11 #3646

gotwarlost opened this issue Jan 2, 2025 · 3 comments
Assignees

Comments

@gotwarlost
Copy link

gotwarlost commented Jan 2, 2025

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

$ cue version
cue version v0.11.1

go version go1.23.1
      -buildmode exe
       -compiler gc
  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
cue.lang.version v0.11.1

Does this issue reproduce with the latest stable release?

yes

What did you do?

Ran a testscript test with the following contents:

# tidy
go mod tidy

# test
exec go run cuelang.org/go/cmd/cue def --inline-imports ./p1
stdin stdout
exec go run cuelang.org/go/cmd/cue eval --out=json -
cmp stdout stdout.golden

-- go.mod --
module mod.example

require cuelang.org/go v0.11.1
-- deps.go --
package deps

import _ "cuelang.org/go/cmd/cue"
-- cue.mod/module.cue --
module: "example.com/def"
language: {
	version: "v0.9.2"
}
-- p1/caller.cue --
package p1

import (
	"example.com/def/p2"
)

r: "us-east-1"
shortRegionName: p2.regionMap[r]

-- p2/callee.cue --
package p2

#RegionMap: {
	"us-east-1": "ue1"
	"us-west_1": "uw1"
}

regionMap: #RegionMap
-- stdout.golden --
{
    "r": "us-east-1",
    "shortRegionName": "ue1"
}

What did you expect to see?

A passing test

What did you see instead?

$ testscript x.txt
> exec sh -c 'cue def --inline-imports ./p1 | cue eval --out=json -'
[stderr]
let[].#x: reference "#RegionMap" not found:
    -:8:6
[exit status 1]
FAIL: x.txt:1: unexpected command failure
failed run

Testing on other versions

$ go install cuelang.org/go/cmd/[email protected]
$ testscript x.txt
PASS
@gotwarlost gotwarlost added NeedsInvestigation Triage Requires triage/attention labels Jan 2, 2025
@gotwarlost
Copy link
Author

gotwarlost commented Jan 3, 2025

git bisect says that the regression was introduced in this commit: a50fa63

@myitcv
Copy link
Member

myitcv commented Jan 3, 2025

@gotwarlost thanks for another great repro. I've confirmed this does indeed bisect to a50fa63. I've tweaked your testscript slightly to make it easier to run in a git bisect run mode.

@myitcv
Copy link
Member

myitcv commented Jan 3, 2025

FWIW this problem occurs for both evalv2 and evalv3.

@myitcv myitcv removed the Triage Requires triage/attention label Jan 3, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Release v0.12 Jan 3, 2025
@myitcv myitcv moved this from Backlog to v0.12.0-alpha.2 in Release v0.12 Jan 3, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Release v0.11 Jan 5, 2025
@mvdan mvdan moved this from Backlog to v0.11.2 in Release v0.11 Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: v0.11.2
Status: v0.12.0-alpha.2
Development

No branches or pull requests

3 participants