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

Expr() doesn't return correct value? #1245

Closed
ying-jeanne opened this issue Sep 1, 2021 · 1 comment
Closed

Expr() doesn't return correct value? #1245

ying-jeanne opened this issue Sep 1, 2021 · 1 comment

Comments

@ying-jeanne
Copy link

ying-jeanne commented Sep 1, 2021

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

0.4.0-alpha.2

$ cue version

Does this issue reproduce with the latest release?

yes

What did you do?

https://github.com/ying-jeanne/cue_test_cases/blob/bf84db6edba61d3479838967d7445f1775393fc3/main.go

What did you expect to see?

........ the v expr() is: [*4 | int] and the length is: 2, ops is | (or doesn't matter)
........ the v expr() is: [*4 | int *7 | int] and the length is: 2, ops is : |
........ the v expr() is: [4 7] and the length is: 2, ops is : |

What did you see instead?

........ the v expr() is: [*4 | int] and the length is: 1, ops is :
........ the v expr() is: [*4 | int *7 | int] and the length is: 2, ops is : |
........ the v expr() is: [4 7] and the length is: 2, ops is : |

PS:
it seems

AType: *4 | int
Foo: {
	Baz: AType | *7
}

with Expr() I am getting 1 cue.Value in the return list, but with

AType: *4 | int
Foo: {
	Baz: AType | *"pool"
}

I am getting 2 cue.Values in the return list...

@mpvl
Copy link
Member

mpvl commented Nov 23, 2021

Analysis: The algorithm incorrectly removes defaults it believes are subsumed by non-default values.

@mpvl mpvl added NeedsFix and removed NeedsInvestigation Triage Requires triage/attention labels Nov 23, 2021
@mpvl mpvl added this to the v0.4.1: bug fixes milestone Nov 23, 2021
cueckoo pushed a commit that referenced this issue Nov 23, 2021
It is necessary to take the default of the subsuming value,
but only if it is a disjunction.

Fixes #1245

Signed-off-by: Marcel van Lohuizen <[email protected]>

Change-Id: Ifd89b79220d8bccb6311aee14d9ae38150014eee
Signed-off-by: Marcel van Lohuizen <[email protected]>
jlongtine pushed a commit to jlongtine/cue that referenced this issue Dec 8, 2021
It is necessary to take the default of the subsuming value,
but only if it is a disjunction.

Fixes cue-lang#1245

Signed-off-by: Marcel van Lohuizen <[email protected]>

Change-Id: Ifd89b79220d8bccb6311aee14d9ae38150014eee
Signed-off-by: Marcel van Lohuizen <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/527953
Unity-Result: CUEcueckoo <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Paul Jolly <[email protected]>
Reviewed-by: Marcel van Lohuizen <[email protected]>
Signed-off-by: Joel Longtine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants