-
Notifications
You must be signed in to change notification settings - Fork 349
Open
Description
What version of CUE are you using (cue version)?
$ cue version
cue version v0.12.0
go version go1.23.5
-buildmode exe
-compiler gc
-trimpath true
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.12.0
Does this issue reproduce with the latest stable release?
Yes
What did you do?
exec cue export test1.cue
cmp stdout golden.json
exec cue export test2.cue
cmp stdout golden.json
-- test1.cue --
"Psycho-Onko-Screening": {
SingleForm: {
formId: "psychoOnkoScreening"
showNumberOfInstances?: bool
}
}
-- test2.cue --
"Psycho-Onko-Screening": {
SingleForm: {
formId: "psychoOnkoScreening"
showNumberOfInstances?: bool
}
} | {
SingleForm: {
formId: "psychoOnkoScreening"
}
}
-- golden.json --
{
"Psycho-Onko-Screening": {
"SingleForm": {
"formId": "psychoOnkoScreening"
}
}
}
What did you expect to see?
A passing test.
What did you see instead?
The test fails with the following message
"Psycho-Onko-Screening": incomplete value {SingleForm:{formId:"psychoOnkoScreening",showNumberOfInstances?:bool}} | {SingleForm:{formId:"psychoOnkoScreening"}}
but showNumberOfInstances?:bool shouldn't cause an incomplete value error, because the field is optional. As the test shows this only happens when an alternative is involved. I'm not sure if it might be correct with respect to the language definition. It seems to also cause performance problems in a larger example because these alternatives aren't resolved / merged. I don't see how {a?: X} would be different from {} | {a?: X} because {a?: X} "includes" {}.
Reactions are currently unavailable