-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/internal/adt: add builtin and import support
- Builtin - BuiltinValidator - import Change-Id: I826ce644cd8d5000ca7998b8eaf6c96ecef6fe02 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6502 Reviewed-by: CUE cueckoo <cueckoo@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
23 changed files
with
735 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# DO NOT EDIT; generated by go run testdata/gen.go | ||
# | ||
|
||
#name: disjunctions | ||
#evalPartial | ||
-- in.cue -- | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,8 @@ a: "" | |
b: 0 | ||
-- out/json -- | ||
{"a":"","b":0} | ||
-- out/eval -- | ||
(struct){ | ||
a: (string){ "" } | ||
b: (int){ 0 } | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
-- in.cue -- | ||
// Label aliases | ||
|
||
// direct | ||
a: [X=string]: X | ||
a: bar: {} | ||
|
||
// in struct | ||
b: [X=string]: {X} | ||
b: bar: {} | ||
|
||
// in structs | ||
c: [X=string]: X | ||
c: [Y=string]: {{{Y}}} | ||
c: bar: {} | ||
|
||
// in sub field | ||
d: [X=string]: name: X | ||
d: bar: {} | ||
|
||
// nested | ||
e: [X=string]: [Y=string]: X + Y | ||
e: foo: bar: {} | ||
|
||
// Field aliases | ||
|
||
bar: 3 | ||
f1: C="foo\(bar)": { | ||
name: "xx" | ||
foo: C.name | ||
} | ||
|
||
// nested | ||
f1: D="foo\(bar)": E="foo\(bar)baz": { | ||
name: "xx" | ||
a: D["foo\(bar)baz"].name | ||
b: E.name | ||
} | ||
|
||
// Combo | ||
|
||
c1: C="foo\(bar)": [D=string]: { | ||
name: D | ||
foo: C.x.name | ||
} | ||
c1: foo3: x: _ | ||
|
||
|
||
// TODO: support. Also not yet supported in old implementation. | ||
// c10: { | ||
// C=[string]: { | ||
// name: "x" | ||
// foo: C.name | ||
// } | ||
// } | ||
// c2: c1 & { x: _ } | ||
|
||
-- out/eval -- | ||
(struct){ | ||
a: (struct){ | ||
bar: (string){ "bar" } | ||
} | ||
b: (struct){ | ||
bar: (string){ "bar" } | ||
} | ||
c: (struct){ | ||
bar: (string){ "bar" } | ||
} | ||
d: (struct){ | ||
bar: (struct){ | ||
name: (string){ "bar" } | ||
} | ||
} | ||
e: (struct){ | ||
foo: (struct){ | ||
bar: (string){ "foobar" } | ||
} | ||
} | ||
bar: (int){ 3 } | ||
f1: (struct){ | ||
foo3: (struct){ | ||
name: (string){ "xx" } | ||
foo: (string){ "xx" } | ||
foo3baz: (struct){ | ||
name: (string){ "xx" } | ||
a: (string){ "xx" } | ||
b: (string){ "xx" } | ||
} | ||
} | ||
} | ||
c1: (struct){ | ||
foo3: (struct){ | ||
x: (struct){ | ||
name: (string){ "x" } | ||
foo: (string){ "x" } | ||
} | ||
} | ||
} | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
a: { | ||
[string]: 〈0;-〉 | ||
} | ||
a: { | ||
bar: {} | ||
} | ||
b: { | ||
[string]: { | ||
〈1;-〉 | ||
} | ||
} | ||
b: { | ||
bar: {} | ||
} | ||
c: { | ||
[string]: 〈0;-〉 | ||
} | ||
c: { | ||
[string]: { | ||
{ | ||
{ | ||
〈3;-〉 | ||
} | ||
} | ||
} | ||
} | ||
c: { | ||
bar: {} | ||
} | ||
d: { | ||
[string]: { | ||
name: 〈1;-〉 | ||
} | ||
} | ||
d: { | ||
bar: {} | ||
} | ||
e: { | ||
[string]: { | ||
[string]: (〈1;-〉 + 〈0;-〉) | ||
} | ||
} | ||
e: { | ||
foo: { | ||
bar: {} | ||
} | ||
} | ||
bar: 3 | ||
f1: { | ||
"foo\(〈1;bar〉)": { | ||
name: "xx" | ||
foo: 〈1;("foo\(〈1;bar〉)")〉.name | ||
} | ||
} | ||
f1: { | ||
"foo\(〈1;bar〉)": { | ||
"foo\(〈2;bar〉)baz": { | ||
name: "xx" | ||
a: 〈2;("foo\(〈1;bar〉)")〉["foo\(〈3;bar〉)baz"].name | ||
b: 〈1;("foo\(〈2;bar〉)baz")〉.name | ||
} | ||
} | ||
} | ||
c1: { | ||
"foo\(〈1;bar〉)": { | ||
[string]: { | ||
name: 〈1;-〉 | ||
foo: 〈2;("foo\(〈1;bar〉)")〉.x.name | ||
} | ||
} | ||
} | ||
c1: { | ||
foo3: { | ||
x: _ | ||
} | ||
} | ||
} |
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,21 @@ | ||
TODO: add maching when bulk optional fields are allowed | ||
alongside other fields. | ||
-- in.cue -- | ||
{[X=string]: baz: X} | ||
bar: {} | ||
-- out/eval -- | ||
(struct){ | ||
bar: (struct){ | ||
baz: (string){ "bar" } | ||
} | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
{ | ||
[string]: { | ||
baz: 〈1;-〉 | ||
} | ||
} | ||
bar: {} | ||
} |
Oops, something went wrong.