Bug in type-checking functions
The type checker's handling of function types does not take into account the dynamic constants that are passed to the function and how this impacts the argument types and return type of the function.
As a concrete example:
fn test<2>(a : array(i32, #0, #1)) -> array(i32, #0, #1)
r = return(start, a)
fn main<3>() -> array(i32, #1, #2)
n = constant(array(i32, #1, #2), [])
c = call<#1, #2>(test, n)
r = return(start, c)
This fails to type check because the parameter type for test is array(i32, #0, #1)
and the type of n
is array(i32, #1, #2)
. These types are actually correct, when we account for substituting the dynamic constants (#1, #2
) into the argument (and return type) of test.