-
Notifications
You must be signed in to change notification settings - Fork 219
Labels
bugSomething isn't working or is incorrectSomething isn't working or is incorrectdslx:TIv2Bugs related to Type Inference v2Bugs related to Type Inference v2
Description
Describe the bug
It seems that range expression don't type-coerce into properly annotated typed array but instead redefine the type binding to be the max size of the range.
To Reproduce
#[test]
fn test_array2d_tiv2() {
let data: u32[8][2] = [0..8, 8..16];
assert_eq(u32:0 ++ u32:8, data[0][0] ++ data[1][0]);
}
0313: fn test_array2d_tiv2() {
0314: let data: u32[8][2] = [0..8, 8..16];
0315: assert_eq(u32:0 ++ u32:8, data[0][0] ++ data[1][0]);
~~~~~~~~~~~~~~~~~~~^----------------------------------------^ FailureError: The program being interpreted failed!
lhs: u64:8
rhs: u9:8
were not equal
0316: }
Expected behavior
I would expect [0..8, 8..16] to get coerced into u32[8][2].
Note that annotating the range expression will work around this issue
#[test]
fn test_array2d_tiv2() {
let data: u32[8][2] = [u32:0..u32:8, u32:8..u32:16];
assert_eq(u32:0 ++ u32:8, data[0][0] ++ data[1][0]);
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't working or is incorrectSomething isn't working or is incorrectdslx:TIv2Bugs related to Type Inference v2Bugs related to Type Inference v2