-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/dep: handle inline composite literals
When a selector selects a field in a literal struct (or list), it should be handled separately. Firstly, the struct (or list) has no path from the root of the CUE value. Before, not handling this resulted in nonsensical path values. Also, because recursive values of literal structs (or lists) have no path, all references should be traversed and found. This adds one more large test case for which the results are not entirely correct. This will be fixed in subsequent CLs. Issue #2247 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I9f4888e9939a7541f2e8f5ae59e7ee7d0f0cb4ed Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/556281 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
- Loading branch information
Showing
5 changed files
with
135 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
internal/core/export/testdata/selfcontained/issue2247.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#inlineImports: true | ||
-- cue.mod/module.cue -- | ||
module: "example.com" | ||
-- x.cue -- | ||
import "example.com/t" | ||
|
||
f: t.p | ||
-- t/t.cue -- | ||
package t | ||
|
||
p: { | ||
c: [int] | ||
d: [c][0] | ||
e: {out: c}.out | ||
f: {out: q}.out | ||
g: {out: q}.out | ||
|
||
h: {out: r: s: string}.out | ||
i: h.r | ||
j: h.r.s | ||
|
||
k: r.k | ||
l: r.k.l | ||
} | ||
|
||
q: { | ||
x: [...int] | ||
} | ||
|
||
r: {out: k: l: string}.out | ||
|
||
-- out/default -- | ||
import "example.com/t" | ||
|
||
f: t.p | ||
-- out/expand_imports -- | ||
f: { | ||
c: [int] | ||
d: [c][0] | ||
e: { | ||
out: c | ||
}.out | ||
f: { | ||
out: Q | ||
}.out | ||
g: { | ||
out: Q | ||
}.out | ||
h: { | ||
out: { | ||
r: { | ||
s: string | ||
} | ||
} | ||
}.out | ||
i: h.r | ||
j: h.r.s | ||
k: K | ||
l: K.l | ||
} | ||
|
||
//cue:path: q | ||
let Q = { | ||
x: [...int] | ||
} | ||
|
||
//cue:path: r.k | ||
let K = { | ||
l: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,4 @@ a: _ | |
b: [a][0] | ||
-- out/default -- | ||
a: _ | ||
b: Index0 | ||
|
||
//cue:path: 0 | ||
let Index0 = a | ||
b: [a][0] |