diff --git a/crates/aiken-lang/src/parser/expr/list.rs b/crates/aiken-lang/src/parser/expr/list.rs index 69dd4b22..8e76eb9f 100644 --- a/crates/aiken-lang/src/parser/expr/list.rs +++ b/crates/aiken-lang/src/parser/expr/list.rs @@ -44,4 +44,9 @@ mod tests { fn int_list() { assert_expr!("[1, 2, 3]"); } + + #[test] + fn list_spread() { + assert_expr!("[1, 2, ..[]]"); + } } diff --git a/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap b/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap new file mode 100644 index 00000000..2009bc42 --- /dev/null +++ b/crates/aiken-lang/src/parser/expr/snapshots/list_spread.snap @@ -0,0 +1,30 @@ +--- +source: crates/aiken-lang/src/parser/expr/list.rs +description: "Code:\n\n[1, 2, ..[]]" +--- +List { + location: 0..12, + elements: [ + Int { + location: 1..2, + value: "1", + base: Decimal { + numeric_underscore: false, + }, + }, + Int { + location: 4..5, + value: "2", + base: Decimal { + numeric_underscore: false, + }, + }, + ], + tail: Some( + List { + location: 9..11, + elements: [], + tail: None, + }, + ), +}