Skip to content

Commit 9b11012

Browse files
GearsDatapackslpil
authored andcommitted
Add tests
1 parent d1d9142 commit 9b11012

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

compiler-core/src/type_/tests/errors.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,3 +3109,14 @@ fn negative_size_pattern() {
31093109
fn zero_size_pattern() {
31103110
assert_error!("let assert <<1:size(0)>> = <<>>");
31113111
}
3112+
3113+
// https://github.com/gleam-lang/gleam/issues/3253
3114+
#[test]
3115+
fn bit_array_using_pattern_variables() {
3116+
assert_error!("let assert #(a, <<b:size(a)>>) = #(2, <<2:2>>)");
3117+
}
3118+
3119+
#[test]
3120+
fn bit_array_using_pattern_variables_from_other_bit_array() {
3121+
assert_error!("let assert #(<<a>>, <<b:size(a)>>) = #(<<2>>, <<2:2>>)");
3122+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
source: compiler-core/src/type_/tests/errors.rs
3+
expression: "let assert #(a, <<b:size(a)>>) = #(2, <<2:2>>)"
4+
---
5+
----- SOURCE CODE
6+
let assert #(a, <<b:size(a)>>) = #(2, <<2:2>>)
7+
8+
----- ERROR
9+
error: Unknown variable
10+
┌─ /src/one/two.gleam:1:26
11+
12+
1let assert #(a, <<b:size(a)>>) = #(2, <<2:2>>)
13+
^
14+
15+
The name `a` is not in scope here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
source: compiler-core/src/type_/tests/errors.rs
3+
expression: "let assert #(<<a>>, <<b:size(a)>>) = #(<<2>>, <<2:2>>)"
4+
---
5+
----- SOURCE CODE
6+
let assert #(<<a>>, <<b:size(a)>>) = #(<<2>>, <<2:2>>)
7+
8+
----- ERROR
9+
error: Unknown variable
10+
┌─ /src/one/two.gleam:1:30
11+
12+
1let assert #(<<a>>, <<b:size(a)>>) = #(<<2>>, <<2:2>>)
13+
^
14+
15+
The name `a` is not in scope here.

0 commit comments

Comments
 (0)