···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 16
4
3
expression: "pub fn go(x) { let assert 1 = x }"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
pub fn go(x) { let assert 1 = x }
···
13
11
const FILEPATH = "src/module.gleam";
14
12
15
13
export function go(x) {
16
16
-
if (x !== 1) {
14
14
+
if (x === 1) {
15
15
+
16
16
+
} else {
17
17
throw makeError(
18
18
"let_assert",
19
19
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 21
4
3
expression: "pub fn go(x) { let assert #(1, 2) = x }"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
pub fn go(x) { let assert #(1, 2) = x }
···
13
11
const FILEPATH = "src/module.gleam";
14
12
15
13
export function go(x) {
16
16
-
if (x[1] !== 2 || x[0] !== 1) {
14
14
+
let $ = x[1];
15
15
+
if ($ === 2) {
16
16
+
let $1 = x[0];
17
17
+
if ($1 === 1) {
18
18
+
19
19
+
} else {
20
20
+
throw makeError(
21
21
+
"let_assert",
22
22
+
FILEPATH,
23
23
+
"my/mod",
24
24
+
1,
25
25
+
"go",
26
26
+
"Pattern match failed, no pattern matched the value.",
27
27
+
{ value: x, start: 15, end: 37, pattern_start: 26, pattern_end: 33 }
28
28
+
)
29
29
+
}
30
30
+
} else {
17
31
throw makeError(
18
32
"let_assert",
19
33
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 287
4
3
expression: "\ntype Wibble {\n Wibble(Int)\n Wobble(Int)\n}\n\npub fn go() {\n let assert Wobble(n) = Wibble(1)\n n\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
38
36
39
37
export function go() {
40
38
let $ = new Wibble(1);
39
39
+
let n;
41
40
throw makeError(
42
41
"let_assert",
43
42
FILEPATH,
···
47
46
"Pattern match failed, no pattern matched the value.",
48
47
{ value: $, start: 66, end: 98, pattern_start: 77, pattern_end: 86 }
49
48
)
50
50
-
49
49
+
return n;
51
50
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 271
4
3
expression: "\ntype Wibble {\n Wibble(Int)\n}\n\npub fn go() {\n let assert Wibble(n) = Wibble(1)\n n\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
28
26
29
27
export function go() {
30
28
let $ = new Wibble(1);
31
31
-
let n = $[0];
29
29
+
let n;
30
30
+
n = $[0];
32
31
return n;
33
32
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 321
4
3
expression: "\ntype Wibble {\n Wibble(Int)\n Wobble(Int)\n Woo(Int)\n}\n\npub fn go() {\n let assert Wobble(n) = todo\n n\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
56
54
{}
57
55
)
58
56
let $ = _block;
59
59
-
if (!($ instanceof Wobble)) {
57
57
+
let n;
58
58
+
if ($ instanceof Wobble) {
59
59
+
n = $[0];
60
60
+
} else {
60
61
throw makeError(
61
62
"let_assert",
62
63
FILEPATH,
···
67
68
{ value: $, start: 79, end: 106, pattern_start: 90, pattern_end: 99 }
68
69
)
69
70
}
70
70
-
let n = $[0];
71
71
return n;
72
72
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 256
4
3
expression: "\npub fn expect(value, message) {\n let assert Ok(inner) = value as case message {\n Ok(message) -> message\n Error(_) -> \"No message provided\"\n }\n inner\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
21
19
const FILEPATH = "src/module.gleam";
22
20
23
21
export function expect(value, message) {
24
24
-
if (!(value instanceof Ok)) {
22
22
+
let inner;
23
23
+
if (value instanceof Ok) {
24
24
+
inner = value[0];
25
25
+
} else {
25
26
throw makeError(
26
27
"let_assert",
27
28
FILEPATH,
···
39
40
{ value: value, start: 35, end: 63, pattern_start: 46, pattern_end: 55 }
40
41
)
41
42
}
42
42
-
let inner = value[0];
43
43
return inner;
44
44
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 191
4
3
expression: "\ntype Wibble {\n Wibble(wibble: String)\n}\n\npub fn main() {\n let assert Wibble(wibble: \"w\" as prefix <> rest) = Wibble(\"wibble\")\n prefix <> rest\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
30
28
31
29
export function main() {
32
30
let $ = new Wibble("wibble");
33
33
-
if (!($ instanceof Wibble) || !$.wibble.startsWith("w")) {
31
31
+
let prefix;
32
32
+
let rest;
33
33
+
let $1 = $.wibble;
34
34
+
if ($1.startsWith("w")) {
35
35
+
prefix = "w";
36
36
+
rest = $1.slice(1);
37
37
+
} else {
34
38
throw makeError(
35
39
"let_assert",
36
40
FILEPATH,
···
41
45
{ value: $, start: 61, end: 128, pattern_start: 72, pattern_end: 109 }
42
46
)
43
47
}
44
44
-
let prefix = "w";
45
45
-
let rest = $.wibble.slice(1);
46
48
return prefix + rest;
47
49
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 179
4
3
expression: "\npub fn main() {\n let assert \"Game \" <> id = \"Game 1\"\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function main() {
20
18
let $ = "Game 1";
21
21
-
if (!$.startsWith("Game ")) {
19
19
+
let id;
20
20
+
if ($.startsWith("Game ")) {
21
21
+
id = $.slice(5);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 19, end: 54, pattern_start: 30, pattern_end: 43 }
30
31
)
31
32
}
32
32
-
let id = $.slice(5);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 231
4
3
expression: "\npub fn unwrap_or_panic(value) {\n let assert Ok(inner) = value as \"Oops, there was an error\"\n inner\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
const FILEPATH = "src/module.gleam";
19
17
20
18
export function unwrap_or_panic(value) {
21
21
-
if (!(value instanceof Ok)) {
19
19
+
let inner;
20
20
+
if (value instanceof Ok) {
21
21
+
inner = value[0];
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: value, start: 35, end: 63, pattern_start: 46, pattern_end: 55 }
30
31
)
31
32
}
32
32
-
let inner = value[0];
33
33
return inner;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 26
4
3
expression: "\npub fn go(x) {\n let assert #(a, #(b, c, 2) as t, _, 1) = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x[3] !== 1 || x[1][2] !== 2) {
18
18
+
let a;
19
19
+
let t;
20
20
+
let b;
21
21
+
let c;
22
22
+
let $ = x[3];
23
23
+
if ($ === 1) {
24
24
+
let $1 = x[1][2];
25
25
+
if ($1 === 2) {
26
26
+
a = x[0];
27
27
+
t = x[1];
28
28
+
b = x[1][0];
29
29
+
c = x[1][1];
30
30
+
} else {
31
31
+
throw makeError(
32
32
+
"let_assert",
33
33
+
FILEPATH,
34
34
+
"my/mod",
35
35
+
3,
36
36
+
"go",
37
37
+
"Pattern match failed, no pattern matched the value.",
38
38
+
{ value: x, start: 18, end: 60, pattern_start: 29, pattern_end: 56 }
39
39
+
)
40
40
+
}
41
41
+
} else {
21
42
throw makeError(
22
43
"let_assert",
23
44
FILEPATH,
···
28
49
{ value: x, start: 18, end: 60, pattern_start: 29, pattern_end: 56 }
29
50
)
30
51
}
31
31
-
let a = x[0];
32
32
-
let t = x[1];
33
33
-
let b = x[1][0];
34
34
-
let c = x[1][1];
35
52
return x;
36
53
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 83
4
3
expression: "pub fn go(x) { let assert 1 = x + 1 }"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
pub fn go(x) { let assert 1 = x + 1 }
···
14
12
15
13
export function go(x) {
16
14
let $ = x + 1;
17
17
-
if ($ !== 1) {
15
15
+
if ($ === 1) {
16
16
+
17
17
+
} else {
18
18
throw makeError(
19
19
"let_assert",
20
20
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 5
4
3
expression: "\npub fn go(x) {\n let assert #(1, 2) = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x[1] !== 2 || x[0] !== 1) {
18
18
+
let $ = x[1];
19
19
+
if ($ === 2) {
20
20
+
let $1 = x[0];
21
21
+
if ($1 === 1) {
22
22
+
23
23
+
} else {
24
24
+
throw makeError(
25
25
+
"let_assert",
26
26
+
FILEPATH,
27
27
+
"my/mod",
28
28
+
3,
29
29
+
"go",
30
30
+
"Pattern match failed, no pattern matched the value.",
31
31
+
{ value: x, start: 18, end: 40, pattern_start: 29, pattern_end: 36 }
32
32
+
)
33
33
+
}
34
34
+
} else {
21
35
throw makeError(
22
36
"let_assert",
23
37
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 359
4
3
expression: "\nfn fun(f) { f(#(2, 4)) }\n\npub fn go() {\n use #(_, n) <- fun\n n\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
22
20
export function go() {
23
21
return fun(
24
22
(_use0) => {
25
25
-
let n = _use0[1];
23
23
+
let n;
24
24
+
n = _use0[1];
26
25
return n;
27
26
},
28
27
);
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/assignments.rs
3
3
-
assertion_line: 243
4
3
expression: "\npub fn expect(value, message) {\n let assert Ok(inner) = value as message\n inner\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
const FILEPATH = "src/module.gleam";
19
17
20
18
export function expect(value, message) {
21
21
-
if (!(value instanceof Ok)) {
19
19
+
let inner;
20
20
+
if (value instanceof Ok) {
21
21
+
inner = value[0];
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: value, start: 35, end: 63, pattern_start: 46, pattern_end: 55 }
30
31
)
31
32
}
32
32
-
let inner = value[0];
33
33
return inner;
34
34
}
···
12
12
----- COMPILED JAVASCRIPT
13
13
export function main(x) {
14
14
let $ = [x];
15
15
-
let x$1 = $[0];
15
15
+
let x$1;
16
16
+
x$1 = $[0];
16
17
return x$1;
17
18
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2076
4
3
expression: "\npub fn main() {\n let assert <<_ as number>> = <<10>>\n number\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function main() {
21
19
let $ = toBitArray([10]);
22
22
-
if ($.bitSize !== 8) {
20
20
+
let number;
21
21
+
if ($.bitSize === 8) {
22
22
+
number = $.byteAt(0);
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: $, start: 18, end: 53, pattern_start: 29, pattern_end: 44 }
31
32
)
32
33
}
33
33
-
let number = $.byteAt(0);
34
34
return number;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2020
4
3
expression: "\npub fn main() {\n let assert <<3.14 as pi:float>> = <<3.14>>\n pi\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function main() {
21
19
let $ = toBitArray([sizedFloat(3.14, 64, true)]);
22
22
-
if ($.bitSize !== 64 || bitArraySliceToFloat($, 0, 64, true) !== 3.14) {
20
20
+
let pi;
21
21
+
if ($.bitSize === 64 && bitArraySliceToFloat($, 0, 64, true) === 3.14) {
22
22
+
pi = 3.14;
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: $, start: 18, end: 60, pattern_start: 29, pattern_end: 49 }
31
32
)
32
33
}
33
33
-
let pi = 3.14;
34
34
return pi;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1992
4
3
expression: "\npub fn main() {\n let assert <<1 as a>> = <<1>>\n a\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function main() {
21
19
let $ = toBitArray([1]);
22
22
-
if ($.bitSize !== 8 || $.byteAt(0) !== 1) {
20
20
+
let a;
21
21
+
if ($.bitSize === 8 && $.byteAt(0) === 1) {
22
22
+
a = 1;
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: $, start: 18, end: 47, pattern_start: 29, pattern_end: 39 }
31
32
)
32
33
}
33
33
-
let a = 1;
34
34
return a;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2048
4
3
expression: "\npub fn main() {\n let assert <<\"Hello, world!\" as message:utf8>> = <<\"Hello, world!\">>\n message\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function main() {
21
19
let $ = toBitArray([stringBits("Hello, world!")]);
20
20
+
let message;
22
21
if (
23
23
-
$.bitSize !== 104 ||
24
24
-
$.byteAt(0) !== 72 ||
25
25
-
$.byteAt(1) !== 101 ||
26
26
-
$.byteAt(2) !== 108 ||
27
27
-
$.byteAt(3) !== 108 ||
28
28
-
$.byteAt(4) !== 111 ||
29
29
-
$.byteAt(5) !== 44 ||
30
30
-
$.byteAt(6) !== 32 ||
31
31
-
$.byteAt(7) !== 119 ||
32
32
-
$.byteAt(8) !== 111 ||
33
33
-
$.byteAt(9) !== 114 ||
34
34
-
$.byteAt(10) !== 108 ||
35
35
-
$.byteAt(11) !== 100 ||
36
36
-
$.byteAt(12) !== 33
22
22
+
$.bitSize === 104 &&
23
23
+
$.byteAt(0) === 72 &&
24
24
+
$.byteAt(1) === 101 &&
25
25
+
$.byteAt(2) === 108 &&
26
26
+
$.byteAt(3) === 108 &&
27
27
+
$.byteAt(4) === 111 &&
28
28
+
$.byteAt(5) === 44 &&
29
29
+
$.byteAt(6) === 32 &&
30
30
+
$.byteAt(7) === 119 &&
31
31
+
$.byteAt(8) === 111 &&
32
32
+
$.byteAt(9) === 114 &&
33
33
+
$.byteAt(10) === 108 &&
34
34
+
$.byteAt(11) === 100 &&
35
35
+
$.byteAt(12) === 33
37
36
) {
37
37
+
message = "Hello, world!";
38
38
+
} else {
38
39
throw makeError(
39
40
"let_assert",
40
41
FILEPATH,
···
45
46
{ value: $, start: 18, end: 86, pattern_start: 29, pattern_end: 64 }
46
47
)
47
48
}
48
48
-
let message = "Hello, world!";
49
49
return message;
50
50
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1105
4
3
expression: "\npub fn go(x) {\n let assert <<_:16, _:8>> = x\n let assert <<_:16-little-signed, _:8>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
const FILEPATH = "src/module.gleam";
19
17
20
18
export function go(x) {
21
21
-
if (x.bitSize !== 24) {
19
19
+
if (x.bitSize >= 16 && x.bitSize === 24) {
20
20
+
21
21
+
} else {
22
22
throw makeError(
23
23
"let_assert",
24
24
FILEPATH,
···
29
29
{ value: x, start: 18, end: 46, pattern_start: 29, pattern_end: 42 }
30
30
)
31
31
}
32
32
-
if (x.bitSize !== 24) {
32
32
+
if (x.bitSize >= 16 && x.bitSize === 24) {
33
33
+
34
34
+
} else {
33
35
throw makeError(
34
36
"let_assert",
35
37
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1818
4
3
expression: "\npub fn go(x) {\n let size = 3\n let assert <<1:size(size)-unit(2)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
20
18
export function go(x) {
21
19
let size = 3;
22
20
if (
23
23
-
size < 0 ||
24
24
-
x.bitSize !== size * 2 ||
25
25
-
bitArraySliceToInt(x, 0, size * 2, true, false) !== 1
21
21
+
size >= 0 &&
22
22
+
x.bitSize === size * 2 &&
23
23
+
bitArraySliceToInt(x, 0, size * 2, true, false) === 1
26
24
) {
25
25
+
26
26
+
} else {
27
27
throw makeError(
28
28
"let_assert",
29
29
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 414
4
3
expression: "\npub fn go(x) {\n let assert <<>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 0) {
18
18
+
if (x.bitSize === 0) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1587
4
3
expression: "\npub fn go(x) {\n let assert <<_, a:2-bytes>> = x\n let assert <<_, b:bytes-size(2)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
const FILEPATH = "src/module.gleam";
19
17
20
18
export function go(x) {
21
21
-
if (x.bitSize !== 24) {
19
19
+
let a;
20
20
+
if (x.bitSize >= 8 && x.bitSize === 24) {
21
21
+
a = bitArraySlice(x, 8, 24);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: x, start: 18, end: 49, pattern_start: 29, pattern_end: 45 }
30
31
)
31
32
}
32
32
-
let a = bitArraySlice(x, 8, 24);
33
33
-
if (x.bitSize !== 24) {
33
33
+
let b;
34
34
+
if (x.bitSize >= 8 && x.bitSize === 24) {
35
35
+
b = bitArraySlice(x, 8, 24);
36
36
+
} else {
34
37
throw makeError(
35
38
"let_assert",
36
39
FILEPATH,
···
41
44
{ value: x, start: 52, end: 89, pattern_start: 63, pattern_end: 85 }
42
45
)
43
46
}
44
44
-
let b = bitArraySlice(x, 8, 24);
45
47
return x;
46
48
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1487
4
3
expression: "\npub fn go(x) {\n let assert <<_:4, f:bits-2, _:1>> = <<0x77:7>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([sizedInt(0x77, 7, true)]);
21
21
-
if ($.bitSize !== 7) {
19
19
+
let f;
20
20
+
if ($.bitSize >= 4 && $.bitSize >= 6 && $.bitSize === 7) {
21
21
+
f = bitArraySlice($, 4, 6);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 64, pattern_start: 29, pattern_end: 51 }
30
31
)
31
32
}
32
32
-
let f = bitArraySlice($, 4, 6);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 439
4
3
expression: "\npub fn go(x) {\n let assert <<1, y>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 1) {
18
18
+
let y;
19
19
+
if (x.bitSize >= 8 && x.byteAt(0) === 1 && x.bitSize === 16) {
20
20
+
y = x.byteAt(1);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 41, pattern_start: 29, pattern_end: 37 }
29
30
)
30
31
}
31
31
-
let y = x.byteAt(1);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1462
4
3
expression: "\npub fn go(x) {\n let assert <<f:bytes-2>> = <<1, 2>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([1, 2]);
21
21
-
if ($.bitSize !== 16) {
19
19
+
let f;
20
20
+
if ($.bitSize === 16) {
21
21
+
f = bitArraySlice($, 0, 16);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 53, pattern_start: 29, pattern_end: 42 }
30
31
)
31
32
}
32
32
-
let f = bitArraySlice($, 0, 16);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1051
4
3
expression: "\npub fn go(x) {\n let n = 16\n let assert <<a:bits-size(n)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function go(x) {
21
19
let n = 16;
22
22
-
if (n < 0 || x.bitSize !== n) {
20
20
+
let a;
21
21
+
if (n >= 0 && x.bitSize === n) {
22
22
+
a = bitArraySlice(x, 0, n);
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: x, start: 31, end: 64, pattern_start: 42, pattern_end: 60 }
31
32
)
32
33
}
33
33
-
let a = bitArraySlice(x, 0, n);
34
34
return x;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1078
4
3
expression: "\npub fn go(x) {\n let n = 3\n let assert <<a:bytes-size(n)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function go(x) {
21
19
let n = 3;
22
22
-
if (n < 0 || x.bitSize !== n * 8) {
20
20
+
let a;
21
21
+
if (n >= 0 && x.bitSize === n * 8) {
22
22
+
a = bitArraySlice(x, 0, n * 8);
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: x, start: 30, end: 64, pattern_start: 41, pattern_end: 60 }
31
32
)
32
33
}
33
33
-
let a = bitArraySlice(x, 0, n * 8);
34
34
return x;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 939
4
3
expression: "\npub fn go(x) {\n let n = 16\n let assert <<a:size(n)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function go(x) {
21
19
let n = 16;
22
22
-
if (n < 0 || x.bitSize !== n) {
20
20
+
let a;
21
21
+
if (n >= 0 && x.bitSize === n) {
22
22
+
a = bitArraySliceToInt(x, 0, n, true, false);
23
23
+
} else {
23
24
throw makeError(
24
25
"let_assert",
25
26
FILEPATH,
···
30
31
{ value: x, start: 31, end: 59, pattern_start: 42, pattern_end: 55 }
31
32
)
32
33
}
33
33
-
let a = bitArraySliceToInt(x, 0, n, true, false);
34
34
return x;
35
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1024
4
3
expression: "\npub fn go(x) {\n let n = 8\n let assert <<a:size(n), 0b010101:size(8)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
20
18
export function go(x) {
21
19
let n = 8;
20
20
+
let a;
22
21
if (
23
23
-
n < 0 ||
24
24
-
x.bitSize !== 8 + n ||
25
25
-
bitArraySliceToInt(x, n, n + 8, true, false) !== 21
22
22
+
n >= 0 &&
23
23
+
x.bitSize >= n &&
24
24
+
x.bitSize === 8 + n &&
25
25
+
bitArraySliceToInt(x, n, n + 8, true, false) === 21
26
26
) {
27
27
+
a = bitArraySliceToInt(x, 0, n, true, false);
28
28
+
} else {
27
29
throw makeError(
28
30
"let_assert",
29
31
FILEPATH,
···
34
36
{ value: x, start: 30, end: 76, pattern_start: 41, pattern_end: 72 }
35
37
)
36
38
}
37
37
-
let a = bitArraySliceToInt(x, 0, n, true, false);
38
39
return x;
39
40
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 995
4
3
expression: "\npub fn go(x) {\n let n = 16\n let n = 5\n let assert <<a:size(n)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
21
19
export function go(x) {
22
20
let n = 16;
23
21
let n$1 = 5;
24
24
-
if (n$1 < 0 || x.bitSize !== n$1) {
22
22
+
let a;
23
23
+
if (n$1 >= 0 && x.bitSize === n$1) {
24
24
+
a = bitArraySliceToInt(x, 0, n$1, true, false);
25
25
+
} else {
25
26
throw makeError(
26
27
"let_assert",
27
28
FILEPATH,
···
32
33
{ value: x, start: 43, end: 71, pattern_start: 54, pattern_end: 67 }
33
34
)
34
35
}
35
35
-
let a = bitArraySliceToInt(x, 0, n$1, true, false);
36
36
return x;
37
37
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 966
4
3
expression: "\npub fn go(x) {\n let n = 16\n let m = 32\n let assert <<first:size(8), a:size(n), b:size(m), rest:bits>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
21
19
export function go(x) {
22
20
let n = 16;
23
21
let m = 32;
24
24
-
if (x.bitSize < 8 + m + n || n < 0 || m < 0) {
22
22
+
let first;
23
23
+
let a;
24
24
+
let b;
25
25
+
let rest;
26
26
+
if (
27
27
+
x.bitSize >= 8 &&
28
28
+
n >= 0 &&
29
29
+
x.bitSize >= 8 + n &&
30
30
+
m >= 0 &&
31
31
+
x.bitSize >= 8 + m + n
32
32
+
) {
33
33
+
first = x.byteAt(0);
34
34
+
a = bitArraySliceToInt(x, 8, 8 + n, true, false);
35
35
+
b = bitArraySliceToInt(x, 8 + n, 8 + n + m, true, false);
36
36
+
rest = bitArraySlice(x, 8 + m + n);
37
37
+
} else {
25
38
throw makeError(
26
39
"let_assert",
27
40
FILEPATH,
···
32
45
{ value: x, start: 44, end: 109, pattern_start: 55, pattern_end: 105 }
33
46
)
34
47
}
35
35
-
let first = x.byteAt(0);
36
36
-
let a = bitArraySliceToInt(x, 8, 8 + n, true, false);
37
37
-
let b = bitArraySliceToInt(x, 8 + n, 8 + n + m, true, false);
38
38
-
let rest = bitArraySlice(x, 8 + m + n);
39
48
return x;
40
49
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1185
4
3
expression: "\npub fn go(x) {\n let assert <<a:float, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 72 || !Number.isFinite(bitArraySliceToFloat(x, 0, 64, true))) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (
21
21
+
x.bitSize >= 64 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 64, true)) &&
23
23
+
x.bitSize === 72
24
24
+
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 64, true);
26
26
+
b = x.byteAt(8);
27
27
+
} else {
21
28
throw makeError(
22
29
"let_assert",
23
30
FILEPATH,
···
28
35
{ value: x, start: 18, end: 51, pattern_start: 29, pattern_end: 47 }
29
36
)
30
37
}
31
31
-
let a = bitArraySliceToFloat(x, 0, 64, true);
32
32
-
let b = x.byteAt(8);
33
38
return x;
34
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1412
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-size(16)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || !Number.isFinite(bitArraySliceToFloat(x, 0, 16, true))) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16 && Number.isFinite(bitArraySliceToFloat(x, 0, 16, true))) {
20
20
+
a = bitArraySliceToFloat(x, 0, 16, true);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 53, pattern_start: 29, pattern_end: 49 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToFloat(x, 0, 16, true);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1210
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-big, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 72 || !Number.isFinite(bitArraySliceToFloat(x, 0, 64, true))) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (
21
21
+
x.bitSize >= 64 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 64, true)) &&
23
23
+
x.bitSize === 72
24
24
+
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 64, true);
26
26
+
b = x.byteAt(8);
27
27
+
} else {
21
28
throw makeError(
22
29
"let_assert",
23
30
FILEPATH,
···
28
35
{ value: x, start: 18, end: 55, pattern_start: 29, pattern_end: 51 }
29
36
)
30
37
}
31
31
-
let a = bitArraySliceToFloat(x, 0, 64, true);
32
32
-
let b = x.byteAt(8);
33
38
return x;
34
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1235
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-little, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
18
18
+
let a;
19
19
+
let b;
20
20
if (
21
21
-
x.bitSize !== 72 ||
22
22
-
!Number.isFinite(bitArraySliceToFloat(x, 0, 64, false))
21
21
+
x.bitSize >= 64 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 64, false)) &&
23
23
+
x.bitSize === 72
23
24
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 64, false);
26
26
+
b = x.byteAt(8);
27
27
+
} else {
24
28
throw makeError(
25
29
"let_assert",
26
30
FILEPATH,
···
31
35
{ value: x, start: 18, end: 58, pattern_start: 29, pattern_end: 54 }
32
36
)
33
37
}
34
34
-
let a = bitArraySliceToFloat(x, 0, 64, false);
35
35
-
let b = x.byteAt(8);
36
38
return x;
37
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1260
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-32, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 40 || !Number.isFinite(bitArraySliceToFloat(x, 0, 32, true))) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (
21
21
+
x.bitSize >= 32 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 32, true)) &&
23
23
+
x.bitSize === 40
24
24
+
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 32, true);
26
26
+
b = x.byteAt(4);
27
27
+
} else {
21
28
throw makeError(
22
29
"let_assert",
23
30
FILEPATH,
···
28
35
{ value: x, start: 18, end: 54, pattern_start: 29, pattern_end: 50 }
29
36
)
30
37
}
31
31
-
let a = bitArraySliceToFloat(x, 0, 32, true);
32
32
-
let b = x.byteAt(4);
33
38
return x;
34
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1285
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-32-big, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 40 || !Number.isFinite(bitArraySliceToFloat(x, 0, 32, true))) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (
21
21
+
x.bitSize >= 32 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 32, true)) &&
23
23
+
x.bitSize === 40
24
24
+
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 32, true);
26
26
+
b = x.byteAt(4);
27
27
+
} else {
21
28
throw makeError(
22
29
"let_assert",
23
30
FILEPATH,
···
28
35
{ value: x, start: 18, end: 58, pattern_start: 29, pattern_end: 54 }
29
36
)
30
37
}
31
31
-
let a = bitArraySliceToFloat(x, 0, 32, true);
32
32
-
let b = x.byteAt(4);
33
38
return x;
34
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1310
4
3
expression: "\npub fn go(x) {\n let assert <<a:float-32-little, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
18
18
+
let a;
19
19
+
let b;
20
20
if (
21
21
-
x.bitSize !== 40 ||
22
22
-
!Number.isFinite(bitArraySliceToFloat(x, 0, 32, false))
21
21
+
x.bitSize >= 32 &&
22
22
+
Number.isFinite(bitArraySliceToFloat(x, 0, 32, false)) &&
23
23
+
x.bitSize === 40
23
24
) {
25
25
+
a = bitArraySliceToFloat(x, 0, 32, false);
26
26
+
b = x.byteAt(4);
27
27
+
} else {
24
28
throw makeError(
25
29
"let_assert",
26
30
FILEPATH,
···
31
35
{ value: x, start: 18, end: 61, pattern_start: 29, pattern_end: 57 }
32
36
)
33
37
}
34
34
-
let a = bitArraySliceToFloat(x, 0, 32, false);
35
35
-
let b = x.byteAt(4);
36
38
return x;
37
39
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1387
4
3
expression: "\npub fn go(x) {\n let assert <<_, 1.1, _:bits>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize < 72 || bitArraySliceToFloat(x, 8, 72, true) !== 1.1) {
18
18
+
if (
19
19
+
x.bitSize >= 8 &&
20
20
+
x.bitSize >= 72 &&
21
21
+
bitArraySliceToFloat(x, 8, 72, true) === 1.1
22
22
+
) {
23
23
+
24
24
+
} else {
21
25
throw makeError(
22
26
"let_assert",
23
27
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1335
4
3
expression: "\npub fn go(x) {\n let assert <<1.4, b:int>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 72 || bitArraySliceToFloat(x, 0, 64, true) !== 1.4) {
18
18
+
let b;
19
19
+
if (
20
20
+
x.bitSize >= 64 &&
21
21
+
bitArraySliceToFloat(x, 0, 64, true) === 1.4 &&
22
22
+
x.bitSize === 72
23
23
+
) {
24
24
+
b = x.byteAt(8);
25
25
+
} else {
21
26
throw makeError(
22
27
"let_assert",
23
28
FILEPATH,
···
28
33
{ value: x, start: 18, end: 47, pattern_start: 29, pattern_end: 43 }
29
34
)
30
35
}
31
31
-
let b = x.byteAt(8);
32
36
return x;
33
37
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1360
4
3
expression: "\npub fn go(x) {\n let n = 1\n let assert <<_:size(n), 1.1, _:bits>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
20
18
export function go(x) {
21
19
let n = 1;
22
20
if (
23
23
-
n < 0 ||
24
24
-
x.bitSize < 64 + n ||
25
25
-
bitArraySliceToFloat(x, n, n + 64, true) !== 1.1
21
21
+
n >= 0 &&
22
22
+
x.bitSize >= n &&
23
23
+
x.bitSize >= 64 + n &&
24
24
+
bitArraySliceToFloat(x, n, n + 64, true) === 1.1
26
25
) {
26
26
+
27
27
+
} else {
27
28
throw makeError(
28
29
"let_assert",
29
30
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1437
4
3
expression: "\npub fn go(x) {\n let assert <<_, b:bytes>> = <<1,2,3>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([1, 2, 3]);
21
21
-
if ($.bitSize < 8 || ($.bitSize - 8) % 8 !== 0) {
19
19
+
let b;
20
20
+
if ($.bitSize >= 8 && ($.bitSize - 8) % 8 === 0) {
21
21
+
b = bitArraySlice($, 8);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 55, pattern_start: 29, pattern_end: 43 }
30
31
)
31
32
}
32
32
-
let b = bitArraySlice($, 8);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1537
4
3
expression: "\npub fn go(x) {\n let assert <<_, b:bits>> = <<1,2,3>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([1, 2, 3]);
21
21
-
if ($.bitSize < 8) {
19
19
+
let b;
20
20
+
if ($.bitSize >= 8) {
21
21
+
b = bitArraySlice($, 8);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 54, pattern_start: 29, pattern_end: 42 }
30
31
)
31
32
}
32
32
-
let b = bitArraySlice($, 8);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1562
4
3
expression: "\npub fn go(x) {\n let assert <<_:5, b:bits>> = <<1,2,3>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([1, 2, 3]);
21
21
-
if ($.bitSize < 5) {
19
19
+
let b;
20
20
+
if ($.bitSize >= 5) {
21
21
+
b = bitArraySlice($, 5);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 56, pattern_start: 29, pattern_end: 44 }
30
31
)
31
32
}
32
32
-
let b = bitArraySlice($, 5);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1512
4
3
expression: "\npub fn go(x) {\n let assert <<_, b:bytes>> = <<1,2,3>>\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
let $ = toBitArray([1, 2, 3]);
21
21
-
if ($.bitSize < 8 || ($.bitSize - 8) % 8 !== 0) {
19
19
+
let b;
20
20
+
if ($.bitSize >= 8 && ($.bitSize - 8) % 8 === 0) {
21
21
+
b = bitArraySlice($, 8);
22
22
+
} else {
22
23
throw makeError(
23
24
"let_assert",
24
25
FILEPATH,
···
29
30
{ value: $, start: 18, end: 55, pattern_start: 29, pattern_end: 43 }
30
31
)
31
32
}
32
32
-
let b = bitArraySlice($, 8);
33
33
return $;
34
34
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 589
4
3
expression: "\npub fn go(x) {\n let assert <<a:signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 8) {
18
18
+
let a;
19
19
+
if (x.bitSize === 8) {
20
20
+
a = bitArraySliceToInt(x, 0, 8, true, true);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 45, pattern_start: 29, pattern_end: 41 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 8, true, true);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 614
4
3
expression: "\npub fn go(x) {\n let assert <<-1:signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 8 || x.byteAt(0) !== 255) {
18
18
+
if (x.bitSize === 8 && x.byteAt(0) === 255) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 464
4
3
expression: "\npub fn go(x) {\n let assert <<a:16, b:8>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 24) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (x.bitSize >= 16 && x.bitSize === 24) {
21
21
+
a = bitArraySliceToInt(x, 0, 16, true, false);
22
22
+
b = x.byteAt(2);
23
23
+
} else {
21
24
throw makeError(
22
25
"let_assert",
23
26
FILEPATH,
···
28
31
{ value: x, start: 18, end: 46, pattern_start: 29, pattern_end: 42 }
29
32
)
30
33
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, true, false);
32
32
-
let b = x.byteAt(2);
33
34
return x;
34
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 639
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-big>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, true, false);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 45, pattern_start: 29, pattern_end: 41 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, true, false);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 664
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-big>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 4 || x.byteAt(1) !== 210) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 4 && x.byteAt(1) === 210) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 789
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-big-signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, true, true);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 52, pattern_start: 29, pattern_end: 48 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, true, true);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 814
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-big-signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 4 || x.byteAt(1) !== 210) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 4 && x.byteAt(1) === 210) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 739
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-big-unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, true, false);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 54, pattern_start: 29, pattern_end: 50 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, true, false);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 764
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-big-unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 4 || x.byteAt(1) !== 210) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 4 && x.byteAt(1) === 210) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 514
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16, 123:8>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize !== 24 ||
22
22
-
x.byteAt(0) !== 4 || x.byteAt(1) !== 210 ||
23
23
-
x.byteAt(2) !== 123
19
19
+
x.bitSize >= 16 &&
20
20
+
x.byteAt(0) === 4 && x.byteAt(1) === 210 &&
21
21
+
x.bitSize === 24 &&
22
22
+
x.byteAt(2) === 123
24
23
) {
24
24
+
25
25
+
} else {
25
26
throw makeError(
26
27
"let_assert",
27
28
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 689
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-little>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, false, false);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 48, pattern_start: 29, pattern_end: 44 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, false, false);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 714
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-little>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 210 || x.byteAt(1) !== 4) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 210 && x.byteAt(1) === 4) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 889
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-little-signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, false, true);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 55, pattern_start: 29, pattern_end: 51 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, false, true);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 914
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-little-signed>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 210 || x.byteAt(1) !== 4) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 210 && x.byteAt(1) === 4) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 839
4
3
expression: "\npub fn go(x) {\n let assert <<a:16-little-unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let a;
19
19
+
if (x.bitSize === 16) {
20
20
+
a = bitArraySliceToInt(x, 0, 16, false, false);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 57, pattern_start: 29, pattern_end: 53 }
29
30
)
30
31
}
31
31
-
let a = bitArraySliceToInt(x, 0, 16, false, false);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 864
4
3
expression: "\npub fn go(x) {\n let assert <<1234:16-little-unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 210 || x.byteAt(1) !== 4) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 210 && x.byteAt(1) === 4) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 489
4
3
expression: "\npub fn go(x) {\n let assert <<a:17, b:7>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 24) {
18
18
+
let a;
19
19
+
let b;
20
20
+
if (x.bitSize >= 17 && x.bitSize === 24) {
21
21
+
a = bitArraySliceToInt(x, 0, 17, true, false);
22
22
+
b = bitArraySliceToInt(x, 17, 24, true, false);
23
23
+
} else {
21
24
throw makeError(
22
25
"let_assert",
23
26
FILEPATH,
···
28
31
{ value: x, start: 18, end: 46, pattern_start: 29, pattern_end: 42 }
29
32
)
30
33
}
31
31
-
let a = bitArraySliceToInt(x, 0, 17, true, false);
32
32
-
let b = bitArraySliceToInt(x, 17, 24, true, false);
33
34
return x;
34
35
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1135
4
3
expression: "\npub fn go(x) {\n let assert <<i:16>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16) {
18
18
+
let i;
19
19
+
if (x.bitSize === 16) {
20
20
+
i = bitArraySliceToInt(x, 0, 16, true, false);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 41, pattern_start: 29, pattern_end: 37 }
29
30
)
30
31
}
31
31
-
let i = bitArraySliceToInt(x, 0, 16, true, false);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1160
4
3
expression: "\npub fn go(x) {\n let assert <<258:16>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 16 || x.byteAt(0) !== 1 || x.byteAt(1) !== 2) {
18
18
+
if (x.bitSize === 16 && x.byteAt(0) === 1 && x.byteAt(1) === 2) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 539
4
3
expression: "\npub fn go(x) {\n let assert <<a:unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 8) {
18
18
+
let a;
19
19
+
if (x.bitSize === 8) {
20
20
+
a = x.byteAt(0);
21
21
+
} else {
21
22
throw makeError(
22
23
"let_assert",
23
24
FILEPATH,
···
28
29
{ value: x, start: 18, end: 47, pattern_start: 29, pattern_end: 43 }
29
30
)
30
31
}
31
31
-
let a = x.byteAt(0);
32
32
return x;
33
33
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 564
4
3
expression: "\npub fn go(x) {\n let assert <<-2:unsigned>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x.bitSize !== 8 || x.byteAt(0) !== 254) {
18
18
+
if (x.bitSize === 8 && x.byteAt(0) === 254) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 286
4
3
expression: "\npub fn go(x) {\n let assert <<\"Gleam 👍\":utf8>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize !== 80 ||
22
22
-
x.byteAt(0) !== 71 ||
23
23
-
x.byteAt(1) !== 108 ||
24
24
-
x.byteAt(2) !== 101 ||
25
25
-
x.byteAt(3) !== 97 ||
26
26
-
x.byteAt(4) !== 109 ||
27
27
-
x.byteAt(5) !== 32 ||
28
28
-
x.byteAt(6) !== 240 ||
29
29
-
x.byteAt(7) !== 159 ||
30
30
-
x.byteAt(8) !== 145 ||
31
31
-
x.byteAt(9) !== 141
19
19
+
x.bitSize === 80 &&
20
20
+
x.byteAt(0) === 71 &&
21
21
+
x.byteAt(1) === 108 &&
22
22
+
x.byteAt(2) === 101 &&
23
23
+
x.byteAt(3) === 97 &&
24
24
+
x.byteAt(4) === 109 &&
25
25
+
x.byteAt(5) === 32 &&
26
26
+
x.byteAt(6) === 240 &&
27
27
+
x.byteAt(7) === 159 &&
28
28
+
x.byteAt(8) === 145 &&
29
29
+
x.byteAt(9) === 141
32
30
) {
31
31
+
32
32
+
} else {
33
33
throw makeError(
34
34
"let_assert",
35
35
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 275
4
3
expression: "\npub fn go(x) {\n let assert <<\"\\\"\\\\\\r\\n\\t\\f\\u{1f600}\">> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize !== 80 ||
22
22
-
x.byteAt(0) !== 34 ||
23
23
-
x.byteAt(1) !== 92 ||
24
24
-
x.byteAt(2) !== 13 ||
25
25
-
x.byteAt(3) !== 10 ||
26
26
-
x.byteAt(4) !== 9 ||
27
27
-
x.byteAt(5) !== 12 ||
28
28
-
x.byteAt(6) !== 240 ||
29
29
-
x.byteAt(7) !== 159 ||
30
30
-
x.byteAt(8) !== 152 ||
31
31
-
x.byteAt(9) !== 128
19
19
+
x.bitSize === 80 &&
20
20
+
x.byteAt(0) === 34 &&
21
21
+
x.byteAt(1) === 92 &&
22
22
+
x.byteAt(2) === 13 &&
23
23
+
x.byteAt(3) === 10 &&
24
24
+
x.byteAt(4) === 9 &&
25
25
+
x.byteAt(5) === 12 &&
26
26
+
x.byteAt(6) === 240 &&
27
27
+
x.byteAt(7) === 159 &&
28
28
+
x.byteAt(8) === 152 &&
29
29
+
x.byteAt(9) === 128
32
30
) {
31
31
+
32
32
+
} else {
33
33
throw makeError(
34
34
"let_assert",
35
35
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2171
4
3
expression: "\npub fn go(x) {\n let assert <<\"Hello\":utf16, _rest:bytes>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize < 80 ||
22
22
-
x.byteAt(0) !== 0 ||
23
23
-
x.byteAt(1) !== 72 ||
24
24
-
x.byteAt(2) !== 0 ||
25
25
-
x.byteAt(3) !== 101 ||
26
26
-
x.byteAt(4) !== 0 ||
27
27
-
x.byteAt(5) !== 108 ||
28
28
-
x.byteAt(6) !== 0 ||
29
29
-
x.byteAt(7) !== 108 ||
30
30
-
x.byteAt(8) !== 0 ||
31
31
-
x.byteAt(9) !== 111 ||
32
32
-
(x.bitSize - 80) % 8 !== 0
19
19
+
x.bitSize >= 80 &&
20
20
+
x.byteAt(0) === 0 &&
21
21
+
x.byteAt(1) === 72 &&
22
22
+
x.byteAt(2) === 0 &&
23
23
+
x.byteAt(3) === 101 &&
24
24
+
x.byteAt(4) === 0 &&
25
25
+
x.byteAt(5) === 108 &&
26
26
+
x.byteAt(6) === 0 &&
27
27
+
x.byteAt(7) === 108 &&
28
28
+
x.byteAt(8) === 0 &&
29
29
+
x.byteAt(9) === 111 &&
30
30
+
(x.bitSize - 80) % 8 === 0
33
31
) {
32
32
+
33
33
+
} else {
34
34
throw makeError(
35
35
"let_assert",
36
36
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2215
4
3
expression: "\npub fn go(x) {\n let assert <<\"Hello\":utf16-little, _rest:bytes>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize < 80 ||
22
22
-
x.byteAt(0) !== 72 ||
23
23
-
x.byteAt(1) !== 0 ||
24
24
-
x.byteAt(2) !== 101 ||
25
25
-
x.byteAt(3) !== 0 ||
26
26
-
x.byteAt(4) !== 108 ||
27
27
-
x.byteAt(5) !== 0 ||
28
28
-
x.byteAt(6) !== 108 ||
29
29
-
x.byteAt(7) !== 0 ||
30
30
-
x.byteAt(8) !== 111 ||
31
31
-
x.byteAt(9) !== 0 ||
32
32
-
(x.bitSize - 80) % 8 !== 0
19
19
+
x.bitSize >= 80 &&
20
20
+
x.byteAt(0) === 72 &&
21
21
+
x.byteAt(1) === 0 &&
22
22
+
x.byteAt(2) === 101 &&
23
23
+
x.byteAt(3) === 0 &&
24
24
+
x.byteAt(4) === 108 &&
25
25
+
x.byteAt(5) === 0 &&
26
26
+
x.byteAt(6) === 108 &&
27
27
+
x.byteAt(7) === 0 &&
28
28
+
x.byteAt(8) === 111 &&
29
29
+
x.byteAt(9) === 0 &&
30
30
+
(x.bitSize - 80) % 8 === 0
33
31
) {
32
32
+
33
33
+
} else {
34
34
throw makeError(
35
35
"let_assert",
36
36
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2182
4
3
expression: "\npub fn go(x) {\n let assert <<\"Hello\":utf32, _rest:bytes>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize < 160 ||
22
22
-
x.byteAt(0) !== 0 ||
23
23
-
x.byteAt(1) !== 0 ||
24
24
-
x.byteAt(2) !== 0 ||
25
25
-
x.byteAt(3) !== 72 ||
26
26
-
x.byteAt(4) !== 0 ||
27
27
-
x.byteAt(5) !== 0 ||
28
28
-
x.byteAt(6) !== 0 ||
29
29
-
x.byteAt(7) !== 101 ||
30
30
-
x.byteAt(8) !== 0 ||
31
31
-
x.byteAt(9) !== 0 ||
32
32
-
x.byteAt(10) !== 0 ||
33
33
-
x.byteAt(11) !== 108 ||
34
34
-
x.byteAt(12) !== 0 ||
35
35
-
x.byteAt(13) !== 0 ||
36
36
-
x.byteAt(14) !== 0 ||
37
37
-
x.byteAt(15) !== 108 ||
38
38
-
x.byteAt(16) !== 0 ||
39
39
-
x.byteAt(17) !== 0 ||
40
40
-
x.byteAt(18) !== 0 ||
41
41
-
x.byteAt(19) !== 111 ||
42
42
-
(x.bitSize - 160) % 8 !== 0
19
19
+
x.bitSize >= 160 &&
20
20
+
x.byteAt(0) === 0 &&
21
21
+
x.byteAt(1) === 0 &&
22
22
+
x.byteAt(2) === 0 &&
23
23
+
x.byteAt(3) === 72 &&
24
24
+
x.byteAt(4) === 0 &&
25
25
+
x.byteAt(5) === 0 &&
26
26
+
x.byteAt(6) === 0 &&
27
27
+
x.byteAt(7) === 101 &&
28
28
+
x.byteAt(8) === 0 &&
29
29
+
x.byteAt(9) === 0 &&
30
30
+
x.byteAt(10) === 0 &&
31
31
+
x.byteAt(11) === 108 &&
32
32
+
x.byteAt(12) === 0 &&
33
33
+
x.byteAt(13) === 0 &&
34
34
+
x.byteAt(14) === 0 &&
35
35
+
x.byteAt(15) === 108 &&
36
36
+
x.byteAt(16) === 0 &&
37
37
+
x.byteAt(17) === 0 &&
38
38
+
x.byteAt(18) === 0 &&
39
39
+
x.byteAt(19) === 111 &&
40
40
+
(x.bitSize - 160) % 8 === 0
43
41
) {
42
42
+
43
43
+
} else {
44
44
throw makeError(
45
45
"let_assert",
46
46
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 2226
4
3
expression: "\npub fn go(x) {\n let assert <<\"Hello\":utf32-little, _rest:bytes>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize < 160 ||
22
22
-
x.byteAt(0) !== 72 ||
23
23
-
x.byteAt(1) !== 0 ||
24
24
-
x.byteAt(2) !== 0 ||
25
25
-
x.byteAt(3) !== 0 ||
26
26
-
x.byteAt(4) !== 101 ||
27
27
-
x.byteAt(5) !== 0 ||
28
28
-
x.byteAt(6) !== 0 ||
29
29
-
x.byteAt(7) !== 0 ||
30
30
-
x.byteAt(8) !== 108 ||
31
31
-
x.byteAt(9) !== 0 ||
32
32
-
x.byteAt(10) !== 0 ||
33
33
-
x.byteAt(11) !== 0 ||
34
34
-
x.byteAt(12) !== 108 ||
35
35
-
x.byteAt(13) !== 0 ||
36
36
-
x.byteAt(14) !== 0 ||
37
37
-
x.byteAt(15) !== 0 ||
38
38
-
x.byteAt(16) !== 111 ||
39
39
-
x.byteAt(17) !== 0 ||
40
40
-
x.byteAt(18) !== 0 ||
41
41
-
x.byteAt(19) !== 0 ||
42
42
-
(x.bitSize - 160) % 8 !== 0
19
19
+
x.bitSize >= 160 &&
20
20
+
x.byteAt(0) === 72 &&
21
21
+
x.byteAt(1) === 0 &&
22
22
+
x.byteAt(2) === 0 &&
23
23
+
x.byteAt(3) === 0 &&
24
24
+
x.byteAt(4) === 101 &&
25
25
+
x.byteAt(5) === 0 &&
26
26
+
x.byteAt(6) === 0 &&
27
27
+
x.byteAt(7) === 0 &&
28
28
+
x.byteAt(8) === 108 &&
29
29
+
x.byteAt(9) === 0 &&
30
30
+
x.byteAt(10) === 0 &&
31
31
+
x.byteAt(11) === 0 &&
32
32
+
x.byteAt(12) === 108 &&
33
33
+
x.byteAt(13) === 0 &&
34
34
+
x.byteAt(14) === 0 &&
35
35
+
x.byteAt(15) === 0 &&
36
36
+
x.byteAt(16) === 111 &&
37
37
+
x.byteAt(17) === 0 &&
38
38
+
x.byteAt(18) === 0 &&
39
39
+
x.byteAt(19) === 0 &&
40
40
+
(x.bitSize - 160) % 8 === 0
43
41
) {
42
42
+
43
43
+
} else {
44
44
throw makeError(
45
45
"let_assert",
46
46
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bit_arrays.rs
3
3
-
assertion_line: 1793
4
3
expression: "\npub fn go(x) {\n let assert <<1:size(2)-unit(2), 2:size(3)-unit(4)>> = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
18
16
19
17
export function go(x) {
20
18
if (
21
21
-
x.bitSize !== 16 ||
22
22
-
bitArraySliceToInt(x, 0, 4, true, false) !== 1 ||
23
23
-
bitArraySliceToInt(x, 4, 16, true, false) !== 2
19
19
+
x.bitSize >= 4 &&
20
20
+
bitArraySliceToInt(x, 0, 4, true, false) === 1 &&
21
21
+
x.bitSize === 16 &&
22
22
+
bitArraySliceToInt(x, 4, 16, true, false) === 2
24
23
) {
24
24
+
25
25
+
} else {
25
26
throw makeError(
26
27
"let_assert",
27
28
FILEPATH,
···
15
15
const FILEPATH = "src/module.gleam";
16
16
17
17
export function go(x) {
18
18
-
if (x[0].bitSize !== 0) {
18
18
+
let $ = x[0];
19
19
+
if ($.bitSize === 0) {
20
20
+
21
21
+
} else {
19
22
throw makeError(
20
23
"let_assert",
21
24
FILEPATH,
···
15
15
const FILEPATH = "src/module.gleam";
16
16
17
17
export function go(x) {
18
18
+
let $ = x[2];
18
19
if (
19
19
-
x[2].bitSize !== 16 ||
20
20
-
x[2].byteAt(0) !== 2 ||
21
21
-
x[2].byteAt(1) !== 3 ||
22
22
-
x[1].bitSize !== 8 ||
23
23
-
x[1].byteAt(0) !== 1 ||
24
24
-
x[0].bitSize !== 0
20
20
+
$.bitSize >= 8 &&
21
21
+
$.byteAt(0) === 2 &&
22
22
+
$.bitSize === 16 &&
23
23
+
$.byteAt(1) === 3
25
24
) {
25
25
+
let $1 = x[1];
26
26
+
if ($1.bitSize === 8 && $1.byteAt(0) === 1) {
27
27
+
let $2 = x[0];
28
28
+
if ($2.bitSize === 0) {
29
29
+
30
30
+
} else {
31
31
+
throw makeError(
32
32
+
"let_assert",
33
33
+
FILEPATH,
34
34
+
"my/mod",
35
35
+
3,
36
36
+
"go",
37
37
+
"Pattern match failed, no pattern matched the value.",
38
38
+
{ value: x, start: 18, end: 57, pattern_start: 29, pattern_end: 53 }
39
39
+
)
40
40
+
}
41
41
+
} else {
42
42
+
throw makeError(
43
43
+
"let_assert",
44
44
+
FILEPATH,
45
45
+
"my/mod",
46
46
+
3,
47
47
+
"go",
48
48
+
"Pattern match failed, no pattern matched the value.",
49
49
+
{ value: x, start: 18, end: 57, pattern_start: 29, pattern_end: 53 }
50
50
+
)
51
51
+
}
52
52
+
} else {
26
53
throw makeError(
27
54
"let_assert",
28
55
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/blocks.rs
3
3
-
assertion_line: 330
4
3
expression: "\nfn side_effects(x) {\n // Some side effects\n x\n}\n\npub fn main() {\n let assert Error(Nil) = side_effects(Ok(10))\n as {\n let message = side_effects(\"some message\")\n message\n }\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
31
29
32
30
export function main() {
33
31
let $ = side_effects(new Ok(10));
34
34
-
if (!($ instanceof Error)) {
32
32
+
if ($ instanceof Error) {
33
33
+
34
34
+
} else {
35
35
throw makeError(
36
36
"let_assert",
37
37
FILEPATH,
···
18
18
let _block;
19
19
{
20
20
let b = [1, 2];
21
21
-
let x = b[0];
22
22
-
let y = b[1];
21
21
+
let x;
22
22
+
let y;
23
23
+
x = b[0];
24
24
+
y = b[1];
23
25
_block = b;
24
26
}
25
27
let a = _block;
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bools.rs
3
3
-
assertion_line: 52
4
3
expression: "\npub fn go(x, y) {\n let assert True = x\n let assert False = x\n let assert Nil = y\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
19
17
const FILEPATH = "src/module.gleam";
20
18
21
19
export function go(x, y) {
22
22
-
if (!x) {
20
20
+
if (x) {
21
21
+
22
22
+
} else {
23
23
throw makeError(
24
24
"let_assert",
25
25
FILEPATH,
···
40
40
{ value: x, start: 43, end: 63, pattern_start: 54, pattern_end: 59 }
41
41
)
42
42
43
43
+
return y;
43
44
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/bools.rs
3
3
-
assertion_line: 67
4
3
expression: "\npub type True { True False Nil }\npub fn go(x, y) {\n let assert True = x\n let assert False = x\n let assert Nil = y\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
26
24
export class Nil extends $CustomType {}
27
25
28
26
export function go(x, y) {
29
29
-
if (!(x instanceof True)) {
27
27
+
if (x instanceof True) {
28
28
+
29
29
+
} else {
30
30
throw makeError(
31
31
"let_assert",
32
32
FILEPATH,
···
46
46
"Pattern match failed, no pattern matched the value.",
47
47
{ value: x, start: 76, end: 96, pattern_start: 87, pattern_end: 92 }
48
48
)
49
49
-
49
49
+
if (y instanceof Nil) {
50
50
+
51
51
+
} else {
52
52
+
throw makeError(
53
53
+
"let_assert",
54
54
+
FILEPATH,
55
55
+
"my/mod",
56
56
+
6,
57
57
+
"go",
58
58
+
"Pattern match failed, no pattern matched the value.",
59
59
+
{ value: y, start: 99, end: 117, pattern_start: 110, pattern_end: 113 }
60
60
+
)
61
61
+
}
62
62
+
return y;
50
63
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/custom_types.rs
3
3
-
assertion_line: 281
4
3
expression: "\npub type Cat {\n Cat(String, cuteness: Int)\n}\n\npub fn go(cat) {\n let Cat(x, y) = cat\n let Cat(cuteness: y, ..) = cat\n let Cat(x, cuteness: y) = cat\n x\n}\n\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
31
29
}
32
30
33
31
export function go(cat) {
34
34
-
let x = cat[0];
35
35
-
let y = cat.cuteness;
36
36
-
let y$1 = cat.cuteness;
37
37
-
let x$1 = cat[0];
38
38
-
let y$2 = cat.cuteness;
32
32
+
let x;
33
33
+
let y;
34
34
+
x = cat[0];
35
35
+
y = cat.cuteness;
36
36
+
let y$1;
37
37
+
y$1 = cat.cuteness;
38
38
+
let x$1;
39
39
+
let y$2;
40
40
+
x$1 = cat[0];
41
41
+
y$2 = cat.cuteness;
39
42
return x$1;
40
43
}
···
31
31
32
32
export function main() {
33
33
let a = new Thing(undefined);
34
34
-
let ctor = a.constructor$;
34
34
+
let ctor;
35
35
+
ctor = a.constructor$;
35
36
let a$1 = a;
36
37
if (a$1.constructor$ === ctor) {
37
38
return undefined;
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/custom_types.rs
3
3
-
assertion_line: 168
4
3
expression: "\npub type Ip {\n Ip(String)\n}\n\npub const local = Ip(\"0.0.0.0\")\n\npub fn build(x) {\n x(\"1.2.3.4\")\n}\n\npub fn go() {\n build(Ip)\n Ip(\"5.6.7.8\")\n}\n\npub fn destructure(x) {\n let Ip(raw) = x\n raw\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
47
45
}
48
46
49
47
export function destructure(x) {
50
50
-
let raw = x[0];
48
48
+
let raw;
49
49
+
raw = x[0];
51
50
return raw;
52
51
}
53
52
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/lists.rs
3
3
-
assertion_line: 62
4
3
expression: "\npub fn go(x, y) {\n let assert [] = x\n let assert [a] = x\n let assert [1, 2] = x\n let assert [_, #(3, b)] = y\n let assert [head, ..tail] = y\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
16
14
17
15
18
16
----- COMPILED JAVASCRIPT
19
19
-
import { Empty as $Empty, NonEmpty as $NonEmpty, makeError } from "../gleam.mjs";
17
17
+
import { Empty as $Empty, makeError } from "../gleam.mjs";
20
18
21
19
const FILEPATH = "src/module.gleam";
22
20
23
21
export function go(x, y) {
24
24
-
if (x instanceof $NonEmpty) {
22
22
+
if (x instanceof $Empty) {
23
23
+
24
24
+
} else {
25
25
throw makeError(
26
26
"let_assert",
27
27
FILEPATH,
···
32
32
{ value: x, start: 21, end: 38, pattern_start: 32, pattern_end: 34 }
33
33
)
34
34
}
35
35
-
if (x instanceof $Empty || x.tail instanceof $NonEmpty) {
35
35
+
let a;
36
36
+
if (x instanceof $Empty) {
36
37
throw makeError(
37
38
"let_assert",
38
39
FILEPATH,
···
42
43
"Pattern match failed, no pattern matched the value.",
43
44
{ value: x, start: 41, end: 59, pattern_start: 52, pattern_end: 55 }
44
45
)
46
46
+
} else {
47
47
+
let $ = x.tail;
48
48
+
if ($ instanceof $Empty) {
49
49
+
a = x.head;
50
50
+
} else {
51
51
+
throw makeError(
52
52
+
"let_assert",
53
53
+
FILEPATH,
54
54
+
"my/mod",
55
55
+
4,
56
56
+
"go",
57
57
+
"Pattern match failed, no pattern matched the value.",
58
58
+
{ value: x, start: 41, end: 59, pattern_start: 52, pattern_end: 55 }
59
59
+
)
60
60
+
}
45
61
}
46
46
-
let a = x.head;
47
47
-
if (
48
48
-
x instanceof $Empty ||
49
49
-
x.tail instanceof $Empty ||
50
50
-
x.tail.tail instanceof $NonEmpty ||
51
51
-
x.tail.head !== 2 ||
52
52
-
x.head !== 1
53
53
-
) {
62
62
+
if (x instanceof $Empty) {
54
63
throw makeError(
55
64
"let_assert",
56
65
FILEPATH,
···
60
69
"Pattern match failed, no pattern matched the value.",
61
70
{ value: x, start: 62, end: 83, pattern_start: 73, pattern_end: 79 }
62
71
)
72
72
+
} else {
73
73
+
let $ = x.tail;
74
74
+
if ($ instanceof $Empty) {
75
75
+
throw makeError(
76
76
+
"let_assert",
77
77
+
FILEPATH,
78
78
+
"my/mod",
79
79
+
5,
80
80
+
"go",
81
81
+
"Pattern match failed, no pattern matched the value.",
82
82
+
{ value: x, start: 62, end: 83, pattern_start: 73, pattern_end: 79 }
83
83
+
)
84
84
+
} else {
85
85
+
let $1 = $.tail;
86
86
+
if ($1 instanceof $Empty) {
87
87
+
let $2 = $.head;
88
88
+
if ($2 === 2) {
89
89
+
let $3 = x.head;
90
90
+
if ($3 === 1) {
91
91
+
92
92
+
} else {
93
93
+
throw makeError(
94
94
+
"let_assert",
95
95
+
FILEPATH,
96
96
+
"my/mod",
97
97
+
5,
98
98
+
"go",
99
99
+
"Pattern match failed, no pattern matched the value.",
100
100
+
{
101
101
+
value: x,
102
102
+
start: 62,
103
103
+
end: 83,
104
104
+
pattern_start: 73,
105
105
+
pattern_end: 79
106
106
+
}
107
107
+
)
108
108
+
}
109
109
+
} else {
110
110
+
throw makeError(
111
111
+
"let_assert",
112
112
+
FILEPATH,
113
113
+
"my/mod",
114
114
+
5,
115
115
+
"go",
116
116
+
"Pattern match failed, no pattern matched the value.",
117
117
+
{ value: x, start: 62, end: 83, pattern_start: 73, pattern_end: 79 }
118
118
+
)
119
119
+
}
120
120
+
} else {
121
121
+
throw makeError(
122
122
+
"let_assert",
123
123
+
FILEPATH,
124
124
+
"my/mod",
125
125
+
5,
126
126
+
"go",
127
127
+
"Pattern match failed, no pattern matched the value.",
128
128
+
{ value: x, start: 62, end: 83, pattern_start: 73, pattern_end: 79 }
129
129
+
)
130
130
+
}
131
131
+
}
63
132
}
64
64
-
if (
65
65
-
y instanceof $Empty ||
66
66
-
y.tail instanceof $Empty ||
67
67
-
y.tail.tail instanceof $NonEmpty ||
68
68
-
y.tail.head[0] !== 3
69
69
-
) {
133
133
+
let b;
134
134
+
if (y instanceof $Empty) {
70
135
throw makeError(
71
136
"let_assert",
72
137
FILEPATH,
···
76
141
"Pattern match failed, no pattern matched the value.",
77
142
{ value: y, start: 86, end: 113, pattern_start: 97, pattern_end: 109 }
78
143
)
144
144
+
} else {
145
145
+
let $ = y.tail;
146
146
+
if ($ instanceof $Empty) {
147
147
+
throw makeError(
148
148
+
"let_assert",
149
149
+
FILEPATH,
150
150
+
"my/mod",
151
151
+
6,
152
152
+
"go",
153
153
+
"Pattern match failed, no pattern matched the value.",
154
154
+
{ value: y, start: 86, end: 113, pattern_start: 97, pattern_end: 109 }
155
155
+
)
156
156
+
} else {
157
157
+
let $1 = $.tail;
158
158
+
if ($1 instanceof $Empty) {
159
159
+
let $2 = $.head[0];
160
160
+
if ($2 === 3) {
161
161
+
b = $.head[1];
162
162
+
} else {
163
163
+
throw makeError(
164
164
+
"let_assert",
165
165
+
FILEPATH,
166
166
+
"my/mod",
167
167
+
6,
168
168
+
"go",
169
169
+
"Pattern match failed, no pattern matched the value.",
170
170
+
{
171
171
+
value: y,
172
172
+
start: 86,
173
173
+
end: 113,
174
174
+
pattern_start: 97,
175
175
+
pattern_end: 109
176
176
+
}
177
177
+
)
178
178
+
}
179
179
+
} else {
180
180
+
throw makeError(
181
181
+
"let_assert",
182
182
+
FILEPATH,
183
183
+
"my/mod",
184
184
+
6,
185
185
+
"go",
186
186
+
"Pattern match failed, no pattern matched the value.",
187
187
+
{ value: y, start: 86, end: 113, pattern_start: 97, pattern_end: 109 }
188
188
+
)
189
189
+
}
190
190
+
}
79
191
}
80
80
-
let b = y.tail.head[1];
192
192
+
let head;
193
193
+
let tail;
81
194
if (y instanceof $Empty) {
82
195
throw makeError(
83
196
"let_assert",
···
88
201
"Pattern match failed, no pattern matched the value.",
89
202
{ value: y, start: 116, end: 145, pattern_start: 127, pattern_end: 141 }
90
203
)
204
204
+
} else {
205
205
+
head = y.head;
206
206
+
tail = y.tail;
91
207
}
92
92
-
let head = y.head;
93
93
-
let tail = y.tail;
94
208
return y;
95
209
}
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/numbers.rs
3
3
-
assertion_line: 146
4
3
expression: "\npub fn go(x) {\n let assert 4 = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x !== 4) {
18
18
+
if (x === 4) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/numbers.rs
3
3
-
assertion_line: 308
4
3
expression: "\npub fn main(x) {\n let assert 09_179.1 = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function main(x) {
20
20
-
if (x !== 9_179.1) {
18
18
+
if (x === 9_179.1) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/numbers.rs
3
3
-
assertion_line: 296
4
3
expression: "\npub fn main(x) {\n let assert 09_179 = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function main(x) {
20
20
-
if (x !== 9_179) {
18
18
+
if (x === 9_179) {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
1
1
---
2
2
source: compiler-core/src/javascript/tests/strings.rs
3
3
-
assertion_line: 60
4
3
expression: "\npub fn go(x) {\n let assert \"Hello\" = x\n}\n"
5
5
-
snapshot_kind: text
6
4
---
7
5
----- SOURCE CODE
8
6
···
17
15
const FILEPATH = "src/module.gleam";
18
16
19
17
export function go(x) {
20
20
-
if (x !== "Hello") {
18
18
+
if (x === "Hello") {
19
19
+
20
20
+
} else {
21
21
throw makeError(
22
22
"let_assert",
23
23
FILEPATH,
···
36
36
return apply(
37
37
new Box(1),
38
38
(_use0) => {
39
39
-
let x = _use0[0];
39
39
+
let x;
40
40
+
x = _use0[0];
40
41
return x;
41
42
},
42
43
);