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

Type-checking values with disjunct defaults produces incorrect output #3250

Closed
stouset opened this issue Jun 26, 2024 · 2 comments
Closed

Type-checking values with disjunct defaults produces incorrect output #3250

stouset opened this issue Jun 26, 2024 · 2 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@stouset
Copy link

stouset commented Jun 26, 2024

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

$ cue version
cue version v0.9.1

go version go1.22.4
      -buildmode exe
       -compiler gc
       -trimpath true
  DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
cue.lang.version v0.9.0

Does this issue reproduce with the latest stable release?

I haven't yet tested with cue v0.9.2, but nothing in the CHANGELOG indicates that this would be affected.

What did you do?

foo: {
  a: false | *{}
  b: false | *{}
  c: false | *{}
}

foo: a: {}
foo: b: false

a_enabled: (foo.a & false) == _|_
b_enabled: (foo.b & false) == _|_
c_enabled: (foo.c & false) == _|_

What did you expect to see?

foo: {
	a: {}
	b: false
	c: {}
}
a_enabled: true
b_enabled: false
c_enabled: true

What did you see instead?

foo: {
	a: {}
	b: false
	c: {}
}
a_enabled: true
b_enabled: false
c_enabled: false # `foo.c & {}` should not be equal to `_|_`
@myitcv
Copy link
Member

myitcv commented Jul 17, 2024

@stouset - my apologies, for some reason I totally missed this. Thanks for raising. If it's ok with you, I will close this in favour of #3292, because I think that issue covers the positive and negative comparisons with _|_.

@myitcv myitcv closed this as completed Jul 17, 2024
@myitcv myitcv reopened this Jul 17, 2024
@myitcv myitcv closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
@mpvl
Copy link
Member

mpvl commented Aug 12, 2024

A default is not "picked" by the & operator. So this behavior is according to the spec.

cueckoo pushed a commit that referenced this issue Oct 18, 2024
`@if` tags are currently treated as false when they're inside
a non-package file inside a module. Add a test case
for this, to be fixed in a subsequent CL.

For #3250.

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I1aafec01ce2586158488bb30d77506622e53eaee
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202737
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
cueckoo pushed a commit that referenced this issue Oct 18, 2024
We were treating files directly specified on the command
line as outside of the module when actually they should not be.

Fixed #3250

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I6b6649aa0e53ed0184a2b3d0648f86bbd98561ed
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202738
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
cueckoo pushed a commit that referenced this issue Oct 22, 2024
`@if` tags are currently treated as false when they're inside
a non-package file inside a module. Add a test case
for this, to be fixed in a subsequent CL.

For #3250.

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I1aafec01ce2586158488bb30d77506622e53eaee
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202737
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202872
cueckoo pushed a commit that referenced this issue Oct 22, 2024
We were treating files directly specified on the command
line as outside of the module when actually they should not be.

Fixed #3250

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I6b6649aa0e53ed0184a2b3d0648f86bbd98561ed
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202738
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202873
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

3 participants