Previously we would assume we do not need to extend beyond the provided (literal) element count, which led to errors when users did:
fn f() -> u32[4] {
let x: u32[4] = [u32:42, ...]; // RHS is actually 1 element here, the u32[4] from the type annotation does /not/ propagate into the array expression as context!
}
This also relates to our recent unifying type inference discussions -- in unifying TI we'd make the right hand side type "at least a u32[1] if not more" and then it would unify with u32[4] to say "ok it's a u32[4] filled with the value 42". cc @richmckeever @meheff
Previously we would assume we do not need to extend beyond the provided (literal) element count, which led to errors when users did:
This also relates to our recent unifying type inference discussions -- in unifying TI we'd make the right hand side type "at least a u32[1] if not more" and then it would unify with
u32[4]
to say "ok it's a u32[4] filled with the value 42". cc @richmckeever @meheff