-
Notifications
You must be signed in to change notification settings - Fork 302
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
"field not allowed" error when embedding a definition inside an if comprehension #3486
Comments
Nicely spotted, this appears to be a bug in both the old and new evaluator. Simplified below:
Which results in the following testscript output:
I know this is a bug because removing the |
The code currently used matchPattern directly in processComprehesionInner, which really should use allows. Hoist the code so it can be shared. We do so in a separate CL to keep no-op changes separated from material ones. We'll fix the bug in a followup CL. Issue #3486 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I02f743898e33c8e6fdd03fccfc9080a9b63535de Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202420 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
Note that the commit above only fixes the issue for the new evaluator, enabled via |
The code currently used matchPattern directly in processComprehesionInner, which really should use allows. Hoist the code so it can be shared. We do so in a separate CL to keep no-op changes separated from material ones. We'll fix the bug in a followup CL. Issue cue-lang#3486 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I02f743898e33c8e6fdd03fccfc9080a9b63535de Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202420 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
This consists of two fixes: 1. use allows instead of matchPattern to check for fields that are not covered by patterns. 2. updates the arcTypes _after_ calling allows, as allows needs the old values. Fixes cue-lang#3486 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I85c04f814bf0cb67a2a57dc10205ad2a309cb61f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202421 Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes
What did you do?
Trying to eval below cue config
What did you expect to see?
I except the
if
condition to evaluate and generate the requiredkarpenter
struct, but it fails. If theif
statement is commented, then code works fine.I understand that
#service_account_annotations:karpenter: {}
is a closed struct , and making it open works.But I am not sure why it complains about the fields of
karpenter
What did you see instead?
The text was updated successfully, but these errors were encountered: