···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 1301
4
3
expression: "\nconst cute = \"cute\"\nconst cute_bee = cute <> \"bee\"\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
Parsed {
8
6
module: Module {
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 1678
4
3
expression: "\ntype Wibble {\n @deprecated(\"1\")\n Wibble1\n Wibble2\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
Parsed {
8
6
module: Module {
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 792
4
3
expression: "import wibble.{type Wobble, Wobble, type Wabble}"
5
5
-
snapshot_kind: text
6
4
---
7
5
Parsed {
8
6
module: Module {
···
1
1
-
---
2
2
-
source: compiler-core/src/parse/tests.rs
3
3
-
expression: "\npub fn main() -> Nil {\n let xs = [1, 2, 3]\n let ys = [5, 6, 7]\n [..xs, 4, ..ys]\n}\n"
4
4
-
---
5
5
-
----- SOURCE CODE
6
6
-
7
7
-
pub fn main() -> Nil {
8
8
-
let xs = [1, 2, 3]
9
9
-
let ys = [5, 6, 7]
10
10
-
[..xs, 4, ..ys]
11
11
-
}
12
12
-
13
13
-
14
14
-
----- ERROR
15
15
-
error: Syntax error
16
16
-
┌─ /src/parse/error.gleam:5:4
17
17
-
│
18
18
-
5 │ [..xs, 4, ..ys]
19
19
-
│ ^^ I wasn't expecting a spread here
20
20
-
21
21
-
Lists are immutable and singly-linked, so to join two or more lists
22
22
-
all the elements of the lists would need to be copied into a new list.
23
23
-
This would be slow, so there is no built-in syntax for it.
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 876
4
3
expression: "\npub fn main() -> Nil {\n let xs = [1, 2, 3]\n let ys = [5, 6, 7]\n [..xs, 4, ..ys]\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 1247
4
3
expression: "\ntype Wibble {\n Wibble(wibble: String)\n}\n\nfn wobble() {\n Wibble(\"a\").\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
Parsed {
8
6
module: Module {
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 1792
4
3
expression: import gleam.io
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
import gleam.io
···
1
1
---
2
2
source: compiler-core/src/parse/tests.rs
3
3
-
assertion_line: 1797
4
3
expression: import one.two.three
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
import one.two.three
···
872
872
}
873
873
874
874
#[test]
875
875
-
fn list_spread_followed_by_another_spread() {
875
875
+
fn list_spread_followed_by_extra_item_and_another_spread() {
876
876
assert_module_error!(
877
877
r#"
878
878
pub fn main() -> Nil {
879
879
let xs = [1, 2, 3]
880
880
let ys = [5, 6, 7]
881
881
[..xs, 4, ..ys]
882
882
+
}
883
883
+
"#
884
884
+
);
885
885
+
}
886
886
+
887
887
+
#[test]
888
888
+
fn list_spread_followed_by_other_spread() {
889
889
+
assert_module_error!(
890
890
+
r#"
891
891
+
pub fn main() -> Nil {
892
892
+
let xs = [1, 2, 3]
893
893
+
let ys = [5, 6, 7]
894
894
+
[1, ..xs, ..ys]
882
895
}
883
896
"#
884
897
);