Skip to content

evalv3 "field not allowed" when repeating schemas with disjunctions #3935

@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 --
out: #SchemaOther | #SchemaSelected
out: #SchemaSelected & {
	spec: {
		name: "foo"
		config: namespace: "bar"
	}
}
#SchemaOther: {
	spec: {
		otherOptional?: int
		otherRegular:   int
		otherRequired!: int
	}
}
#SchemaSelected: {
	spec!: {
		name!: string
		config!: _
	}

	if true {
		namespace: _specConfig.namespace
	}

	_specConfig: spec.config
}

as of a3db8b8:

# evalv2 (0.009s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue export in.cue
[stdout]
{
    "out": {
        "namespace": "bar",
        "spec": {
            "name": "foo",
            "config": {
                "namespace": "bar"
            }
        }
    }
}
# evalv3 (0.008s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue export in.cue
[stderr]
out: 4 errors in empty disjunction:
out.spec.config: field not allowed:
    ./in.cue:5:3
    ./in.cue:18:3
out.spec.name: field not allowed:
    ./in.cue:4:3
    ./in.cue:17:3
out.spec.otherRegular: field not allowed:
    ./in.cue:11:3
out.spec.otherRequired: field not allowed:
    ./in.cue:12:3
[exit status 1]
FAIL: repro-evalv3.txtar:7: unexpected command failure

Thanks to Dumitru Sbenghe for providing a reproducer privately via Unity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bisectedRegression which has been bisected to one changeevaluatorevalv3issues affecting only the evaluator version 3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions