diff --git a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_base16.snap b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_base16.snap index 36d36a2a..e779f24a 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_base16.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_base16.snap @@ -5,9 +5,18 @@ description: "Code:\n\n#\"00aaff\"" ByteArray { location: 0..9, bytes: [ - 0, - 170, - 255, + ( + 0, + 0..0, + ), + ( + 170, + 0..0, + ), + ( + 255, + 0..0, + ), ], preferred_format: HexadecimalString, } diff --git a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_basic.snap b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_basic.snap index 58c6b407..8ca0f30a 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_basic.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_basic.snap @@ -5,9 +5,18 @@ description: "Code:\n\n#[0, 170, 255]" ByteArray { location: 0..14, bytes: [ - 0, - 170, - 255, + ( + 0, + 2..3, + ), + ( + 170, + 5..8, + ), + ( + 255, + 10..13, + ), ], preferred_format: ArrayOfBytes( Decimal { diff --git a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_encoded.snap b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_encoded.snap index 611eefcf..2fe656f6 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_encoded.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_encoded.snap @@ -5,11 +5,26 @@ description: "Code:\n\n\"aiken\"" ByteArray { location: 0..7, bytes: [ - 97, - 105, - 107, - 101, - 110, + ( + 97, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), ], preferred_format: Utf8String, } diff --git a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_escaped.snap b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_escaped.snap index 1f385b21..96350718 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_escaped.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/bytearray_utf8_escaped.snap @@ -5,13 +5,34 @@ description: "Code:\n\n\"\\\"aiken\\\"\"" ByteArray { location: 0..11, bytes: [ - 34, - 97, - 105, - 107, - 101, - 110, - 34, + ( + 34, + 0..0, + ), + ( + 97, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), + ( + 34, + 0..0, + ), ], preferred_format: Utf8String, } diff --git a/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled.snap b/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled.snap index d6274e00..8465d580 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled.snap @@ -12,11 +12,26 @@ Call { value: ByteArray { location: 13..20, bytes: [ - 65, - 105, - 107, - 101, - 110, + ( + 65, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled_with_field_access.snap b/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled_with_field_access.snap index f4738e38..0a78f3a4 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled_with_field_access.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/record_create_labeled_with_field_access.snap @@ -12,11 +12,26 @@ Call { value: ByteArray { location: 25..32, bytes: [ - 65, - 105, - 107, - 101, - 110, + ( + 65, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/parser/expr/snapshots/record_update_basic.snap b/crates/aiken-lang/src/parser/expr/snapshots/record_update_basic.snap index 69e8ebb8..ed9dc549 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/record_update_basic.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/record_update_basic.snap @@ -22,11 +22,26 @@ RecordUpdate { value: ByteArray { location: 21..28, bytes: [ - 65, - 105, - 107, - 101, - 110, + ( + 65, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/parser/expr/snapshots/todo_expr.snap b/crates/aiken-lang/src/parser/expr/snapshots/todo_expr.snap index 3dd7a245..a1f6e174 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/todo_expr.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/todo_expr.snap @@ -19,18 +19,36 @@ Trace { ByteArray { location: 18..23, bytes: [ - 102, - 111, - 111, + ( + 102, + 0..0, + ), + ( + 111, + 0..0, + ), + ( + 111, + 0..0, + ), ], preferred_format: Utf8String, }, ByteArray { location: 25..30, bytes: [ - 98, - 97, - 114, + ( + 98, + 0..0, + ), + ( + 97, + 0..0, + ), + ( + 114, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/parser/expr/snapshots/trace_expr.snap b/crates/aiken-lang/src/parser/expr/snapshots/trace_expr.snap index b64f649e..b40bd112 100644 --- a/crates/aiken-lang/src/parser/expr/snapshots/trace_expr.snap +++ b/crates/aiken-lang/src/parser/expr/snapshots/trace_expr.snap @@ -20,18 +20,36 @@ Trace { ByteArray { location: 19..24, bytes: [ - 102, - 111, - 111, + ( + 102, + 0..0, + ), + ( + 111, + 0..0, + ), + ( + 111, + 0..0, + ), ], preferred_format: Utf8String, }, ByteArray { location: 26..31, bytes: [ - 98, - 97, - 114, + ( + 98, + 0..0, + ), + ( + 97, + 0..0, + ), + ( + 114, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/parser/pattern/snapshots/pattern_bytearray.snap b/crates/aiken-lang/src/parser/pattern/snapshots/pattern_bytearray.snap index a23e6a4c..e46266f4 100644 --- a/crates/aiken-lang/src/parser/pattern/snapshots/pattern_bytearray.snap +++ b/crates/aiken-lang/src/parser/pattern/snapshots/pattern_bytearray.snap @@ -15,9 +15,18 @@ When { ByteArray { location: 18..27, value: [ - 0, - 171, - 205, + ( + 0, + 0..0, + ), + ( + 171, + 0..0, + ), + ( + 205, + 0..0, + ), ], preferred_format: HexadecimalString, }, @@ -33,19 +42,58 @@ When { ByteArray { location: 40..55, value: [ - 65, - 105, - 107, - 101, - 110, - 44, - 32, - 114, - 111, - 99, - 107, - 115, - 33, + ( + 65, + 0..0, + ), + ( + 105, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 101, + 0..0, + ), + ( + 110, + 0..0, + ), + ( + 44, + 0..0, + ), + ( + 32, + 0..0, + ), + ( + 114, + 0..0, + ), + ( + 111, + 0..0, + ), + ( + 99, + 0..0, + ), + ( + 107, + 0..0, + ), + ( + 115, + 0..0, + ), + ( + 33, + 0..0, + ), ], preferred_format: Utf8String, }, @@ -61,10 +109,22 @@ When { ByteArray { location: 68..81, value: [ - 1, - 2, - 3, - 4, + ( + 1, + 70..71, + ), + ( + 2, + 73..74, + ), + ( + 3, + 76..77, + ), + ( + 4, + 79..80, + ), ], preferred_format: ArrayOfBytes( Decimal { @@ -84,9 +144,18 @@ When { ByteArray { location: 94..113, value: [ - 0, - 171, - 205, + ( + 0, + 96..100, + ), + ( + 171, + 102..106, + ), + ( + 205, + 108..112, + ), ], preferred_format: ArrayOfBytes( Hexadecimal, diff --git a/crates/aiken-lang/src/snapshots/parse_unicode_offset_1.snap b/crates/aiken-lang/src/snapshots/parse_unicode_offset_1.snap index 29f96a21..25037f2b 100644 --- a/crates/aiken-lang/src/snapshots/parse_unicode_offset_1.snap +++ b/crates/aiken-lang/src/snapshots/parse_unicode_offset_1.snap @@ -18,9 +18,18 @@ Module { value: ByteArray { location: 21..26, bytes: [ - 226, - 152, - 133, + ( + 226, + 0..0, + ), + ( + 152, + 0..0, + ), + ( + 133, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/snapshots/parse_unicode_offset_2.snap b/crates/aiken-lang/src/snapshots/parse_unicode_offset_2.snap index f491a175..9b47388a 100644 --- a/crates/aiken-lang/src/snapshots/parse_unicode_offset_2.snap +++ b/crates/aiken-lang/src/snapshots/parse_unicode_offset_2.snap @@ -18,7 +18,10 @@ Module { value: ByteArray { location: 21..24, bytes: [ - 42, + ( + 42, + 0..0, + ), ], preferred_format: Utf8String, }, diff --git a/crates/aiken-lang/src/tipo/expr.rs b/crates/aiken-lang/src/tipo/expr.rs index 6ba7557f..f1d9a035 100644 --- a/crates/aiken-lang/src/tipo/expr.rs +++ b/crates/aiken-lang/src/tipo/expr.rs @@ -555,7 +555,11 @@ impl<'a, 'b> ExprTyper<'a, 'b> { bytes, preferred_format, location, - } => self.infer_bytearray(bytes, preferred_format, location), + } => self.infer_bytearray( + bytes.into_iter().map(|(b, _)| b).collect(), + preferred_format, + location, + ), UntypedExpr::CurvePoint { location, diff --git a/crates/aiken-lang/src/tipo/pattern.rs b/crates/aiken-lang/src/tipo/pattern.rs index 0062f2d5..76b15249 100644 --- a/crates/aiken-lang/src/tipo/pattern.rs +++ b/crates/aiken-lang/src/tipo/pattern.rs @@ -210,7 +210,7 @@ impl<'a, 'b> PatternTyper<'a, 'b> { Ok(Pattern::ByteArray { location, - value, + value: value.into_iter().map(|(b, _)| b).collect(), preferred_format, }) } diff --git a/crates/aiken-project/src/config.rs b/crates/aiken-project/src/config.rs index 9c93da78..580fa8e5 100644 --- a/crates/aiken-project/src/config.rs +++ b/crates/aiken-project/src/config.rs @@ -126,7 +126,7 @@ impl SimpleExpr { }, SimpleExpr::ByteArray(bs, preferred_format) => UntypedExpr::ByteArray { location: Span::empty(), - bytes: bs.to_vec(), + bytes: bs.iter().map(|b| (*b, Span::empty())).collect(), preferred_format: *preferred_format, }, SimpleExpr::List(es) => match annotation {