Skip to content

evalv3 "field set was already referenced" regression with a comprehension and pattern matches #3941

@mvdan

Description

@mvdan
# evalv2
env CUE_EXPERIMENT=evalv3=0
exec cue export in.cue

# evalv3
env CUE_EXPERIMENT=evalv3=1
exec cue export in.cue

-- in.cue --
#Metadata: name: string
#Resource: metadata: #Metadata

out: {
	_metadata: name: "foo"
	resource: [string]: [string]: #Resource

	_names: [_metadata.name]

	for name in _names {
		resource: level1: (name): {
			metadata: _metadata
		}
	}
}

as of 9a44314:

# evalv2 (0.007s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue export in.cue
[stdout]
{
    "out": {
        "resource": {
            "level1": {
                "foo": {
                    "metadata": {
                        "name": "foo"
                    }
                }
            }
        }
    }
}
# evalv3 (0.006s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue export in.cue
[stderr]
out.resource.level1.foo.metadata: adding field name not allowed as field set was already referenced:
    ./in.cue:2:22
[exit status 1]
FAIL: repro-evalv3.txtar:7: unexpected command failure

Thanks to @SafetyCulture for reporting this via Unity!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bisectedRegression which has been bisected to one changeevaluatorevalv3issues affecting only the evaluator version 3unity-winbugs found thanks to projects added to Unity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions