Open lswith opened 11 months ago
For reference, this is fixed if I don't nest 3 packages. It only happens with 3 or more.
This could be related to https://github.com/cue-lang/cue/issues/1446
foo
package has only 2 fields, why would we expect "x-1"
get lifted to the same level as bar.c
?package fizzbuzz
import (
"list"
)
#C: {
Test: int
}
c: #C
for i in list.Range(1, c.Test, 1) {
"x-\(i)": "\(i)"
}
You are referencing the c
in this file in the list.Range
, so the c.Test
is incomplete as I expect it would be
I do not think you can (or should be able to) inject data into an import, which is what it looks like you are trying to do?
There is an outstanding issue to ensure that imports are closed.
I wasn't aware that injecting data into an import was a no go.
For reference, I was creating a package that contained a bunch of "template" objects and then passing in configuration into those packages using imports. I guess I should be inverting this?
The only large cue codebase example I can find is https://github.com/cue-lang/proposal/tree/main/internal/ci. I'll try and use the inversion similar to how the "base" and "repo" packages do it.
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes.
What did you do?
I've created a minimal example of the issue at https://github.com/lswith/breaking_cue
If you run
cue eval -c
in thebar/
folder, the following error occurs:What did you expect to see?
I expected that he list would be evaluated since the value is concrete in the
bar
package. Something like:What did you see instead?