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

evaluator: two level comprehension loses keys #1974

Closed
rogpeppe opened this issue Oct 10, 2022 · 1 comment
Closed

evaluator: two level comprehension loses keys #1974

rogpeppe opened this issue Oct 10, 2022 · 1 comment

Comments

@rogpeppe
Copy link
Member

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

$ cue version
cue version v0.0.0-20221001181137-79d80efc2882

      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
             vcs git
    vcs.revision 79d80efc288208410f77d47ae9aedd37e106d84b
        vcs.time 2022-10-01T18:11:37Z
    vcs.modified false

Does this issue reproduce with the latest release?

No, it's on tip only.

What did you do?

exec cue export test.cue
cmp stdout expect.json

-- test.cue --
in: {
	foo: {
		bar: ""
		baz: ""
	}
}
out: {
	for k, v in in for vk, vv in v {
		"\(k)": "\(vk)": vv
	}
}
-- expect.json --
{
    "in": {
        "foo": {
            "bar": "",
            "baz": ""
        }
    },
    "out": {
        "foo": {
            "bar": "",
            "baz": ""
        }
    }
}

What did you expect to see?

A passing testscript run.

What did you see instead?

> exec cue export test.cue
[stdout]
{
    "in": {
        "foo": {
            "bar": "",
            "baz": ""
        }
    },
    "out": {
        "foo": {
            "bar": ""
        }
    }
}
> cmp stdout expect.json
--- stdout
+++ expect.json
@@ -7,7 +7,8 @@
     },
     "out": {
         "foo": {
-            "bar": ""
+            "bar": "",
+            "baz": ""
         }
     }
 }

FAIL: /tmp/testscript382054878/x.txtar/script.txtar:2: stdout and expect.json differ

Thanks to @fionera on the CUE Slack for reporting this issue.
Bisected to 6b3fd65

@rogpeppe rogpeppe added NeedsInvestigation Triage Requires triage/attention NeedsFix and removed NeedsInvestigation Triage Requires triage/attention labels Oct 10, 2022
@myitcv myitcv added this to the v0.5.0 comprehension rework milestone Oct 10, 2022
@mpvl
Copy link
Member

mpvl commented Nov 2, 2022

This is caused by an overaggressive performance optimization which was a bit overzealous removing duplicates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants