xls
xls copied to clipboard
syntax ambiguity between cast and explicit tuple type annotation
Describe the bug It seems that the DSLX intepreter can't type check tuple explicit type declaration.
To Reproduce The following snippets
let a = (u8, u16)[1]:[(u8:8, u16:64)];
produces the following error:
0003: fn some_tuple() -> u8 {
0004: type T = (u8, u16);
0005: let a = (u8, u16)[1]:[(u8:8, u16:64)];
~~~~~~~~~~~~~~~~~~~^ ParseError: Expected ':', got ',': Expect colon after type annotation in cast
0006: a[0].0
0007: }
Expected behavior
This should typecheck successfully.
Additional context
Adding a local type aliase workaround the issue:
type T = (u8, u16);
let a = T[1]:[(u8:8, u16:64)];