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

Question about Value.IsConcrete()? #883

Closed
cueckoo opened this issue Jul 3, 2021 · 2 comments
Closed

Question about Value.IsConcrete()? #883

cueckoo opened this issue Jul 3, 2021 · 2 comments

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @verdverm in cuelang/cue#883

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

0.3.0

What did you do?

Called cue.Value.IsConcrete() via the Go API and got unexpected results. If this does indeed seem like a bug, then I can create a reproducer.

In the example below, calling IsConcrete() for ex.bar. reports true, is this expected?

#A: {
  a1: string
  a2: string | *""
}

#B: {
  foo: string
  bar: #A
}

ex: #B & {
  foo: "foo"
}

What did you expect to see?

ex.bar.IsConcrete() returning false

What did you see instead?

ex.bar.IsConcrete() returning true

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @myitcv in cuelang/cue#883 (comment)

AFAIU, this is working "as expected" but is effectively the same problem of a list type defaulting to [], picked up in the required fields proposal. i.e. the default value of #A here is {}. What I think you are looking to distinguish is whether ex.bar is specified or not, and that is where the ! proposal comes in.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#883 (comment)

It is working as expected because, as documented, a struct is always considered concrete.

As per the doc:

It does not verify that values of lists or structs are concrete themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant