-
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.
internal/core: finalize list in slice
Fixes #500 Change-Id: Iecd8f46c36c1765b86d1d86a917d0a0889786a09 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7042 Reviewed-by: CUE cueckoo <cueckoo@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
-- in.cue -- | ||
package x | ||
|
||
import "strings" | ||
|
||
a: strings.Join(strings.Split("test", "")[1:], "") | ||
|
||
b: strings.Join(["t", "e", "s", "t"][1:], "") | ||
|
||
c: ["t", "e", "s", "t"][1:] | ||
d: strings.Join(c, "") | ||
|
||
e: strings.Join(["a"] + ["b"], "") | ||
|
||
f: ["a"] + ["b"] | ||
g: strings.Join(f, "") | ||
|
||
h: strings.Join(3*["a"], "") | ||
|
||
i: 3 * ["b"] | ||
j: strings.Join(i, "") | ||
|
||
-- out/eval -- | ||
(struct){ | ||
a: (string){ "est" } | ||
b: (string){ "est" } | ||
c: (#list){ | ||
0: (string){ "e" } | ||
1: (string){ "s" } | ||
2: (string){ "t" } | ||
} | ||
d: (string){ "est" } | ||
e: (string){ "ab" } | ||
f: (#list){ | ||
0: (string){ "a" } | ||
1: (string){ "b" } | ||
} | ||
g: (string){ "ab" } | ||
h: (string){ "aaa" } | ||
i: (#list){ | ||
0: (string){ "b" } | ||
1: (string){ "b" } | ||
2: (string){ "b" } | ||
} | ||
j: (string){ "bbb" } | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
a: 〈import;strings〉.Join(〈import;strings〉.Split("test", "")[1:], "") | ||
b: 〈import;strings〉.Join([ | ||
"t", | ||
"e", | ||
"s", | ||
"t", | ||
][1:], "") | ||
c: [ | ||
"t", | ||
"e", | ||
"s", | ||
"t", | ||
][1:] | ||
d: 〈import;strings〉.Join(〈0;c〉, "") | ||
e: 〈import;strings〉.Join(([ | ||
"a", | ||
] + [ | ||
"b", | ||
]), "") | ||
f: ([ | ||
"a", | ||
] + [ | ||
"b", | ||
]) | ||
g: 〈import;strings〉.Join(〈0;f〉, "") | ||
h: 〈import;strings〉.Join((3 * [ | ||
"a", | ||
]), "") | ||
i: (3 * [ | ||
"b", | ||
]) | ||
j: 〈import;strings〉.Join(〈0;i〉, "") | ||
} |
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