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 assumes a consuming type for something declared non-consuming #2067

Closed
athas opened this issue Jan 5, 2024 · 0 comments
Closed

Comments

@athas
Copy link
Member

athas commented Jan 5, 2024

def main (xs: *[]i32) =
  loop xs : []i32 for i < 10 do
    xs with [i] = i+1

Here we mark the loop parameter xs as non-consuming. However, the type checker infers that it must be consuming. Unfortunately, the internaliser trusts the non-consuming type annotation, leading to invalid IR and a compiler crash.

Inferring the uniquess/consumption of a loop parameter is pretty standard, but should we also do it when there is an explicit annotation, like here?

@athas athas self-assigned this Jan 5, 2024
athas added a commit that referenced this issue Jan 7, 2024
@athas athas closed this as completed in d146daf Jan 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