Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type checker does not detect size mismatch in loop #2144

Closed
athas opened this issue May 7, 2024 · 2 comments
Closed

Type checker does not detect size mismatch in loop #2144

athas opened this issue May 7, 2024 · 2 comments
Assignees

Comments

@athas
Copy link
Member

athas commented May 7, 2024

This leads to a crash later in compilation.

def hide [m] (aoa_shp: [m]i32) : ?[n].[n]i32 =
  filter (!=0) aoa_shp

entry main [n] (iv : [n]bool) =
  loop (wrk, wrk_shp) = (iv,  [(i32.i64 n)]) for _i < 2 do
  let flags = hide wrk_shp
  let min = zip flags wrk -- There is no way 'wrk' can have the right shape here.
  in (wrk ++ wrk, wrk_shp ++ wrk_shp)

I remember fixing a similar bug about a year ago.

@athas athas self-assigned this May 7, 2024
@athas
Copy link
Member Author

athas commented May 7, 2024

Similar to #1565.

@athas
Copy link
Member Author

athas commented May 7, 2024

The problem is that we take the existential size produced by hide and promote it to a loop-carried size, which is nonsensical. The type checker should check the binding level before doing that.

@athas athas closed this as completed in 2b2dd73 May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant