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: let expression scoping works differently from current evaluator #3150

Closed
gotwarlost opened this issue May 15, 2024 · 1 comment
Closed
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@gotwarlost
Copy link

gotwarlost commented May 15, 2024

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

$ cue version
cue version v0.9.0-alpha.4

go version go1.21.3
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
cue.lang.version v0.9.0

Does this issue reproduce with the latest stable release?

N/A

What did you do?

# old evaluator
env CUE_EXPERIMENT=''
exec cue export fruits.cue
cmp stdout stdout.golden

# new evaluator
env CUE_EXPERIMENT='evalv3'
exec cue export fruits.cue
cmp stdout stdout.golden

-- fruits.cue --
#fruits: tier1: [ "apples", "bananas"]
#fruits: tier2: [ "peaches", "pears" ]

fruitsByTier: {
    for _tier in ["tier1", "tier2" ] {
        let items = #fruits[_tier]
        (_tier):  items
    }
}

-- stdout.golden --
{
    "fruitsByTier": {
        "tier1": [
            "apples",
            "bananas"
        ],
        "tier2": [
            "peaches",
            "pears"
        ]
    }
}

What did you expect to see?

Passing test.

What did you see instead?

# old evaluator (0.058s)
# new evaluator (0.020s)
> env CUE_EXPERIMENT='evalv3'
> exec cue export fruits.cue
[stderr]
fruitsByTier.items.0: conflicting values "peaches" and "apples":
    ./fruits.cue:1:19
    ./fruits.cue:2:19
fruitsByTier.items.1: conflicting values "pears" and "bananas":
    ./fruits.cue:1:29
    ./fruits.cue:2:30
[exit status 1]
FAIL: /var/folders/fw/1zj_t77d3rg41kh6x21g0w8w0000gn/T/testscript2240517181/repro.txt/script.txtar:8: unexpected command failure
@gotwarlost gotwarlost added NeedsInvestigation Triage Requires triage/attention labels May 15, 2024
@gotwarlost
Copy link
Author

gotwarlost commented May 21, 2024

Seems to have been fixed on the master branch. Closing as a result.

 $ testscript repro.txt
# old evaluator (0.020s)
# new evaluator (0.019s)
PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant