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

For loop variables not being typed when using generalized iteration with __iter metamethod #819

Open
centau opened this issue Jan 27, 2023 · 2 comments
Labels
bug Something isn't working fixed by new solver This issue is confirmed to be fixed in the new solver. prioritized We plan to do this

Comments

@centau
Copy link

centau commented Jan 27, 2023

The typechecker seems to be unable to infer the types of variables declared in the for ... in list when using generalized iteration with the __iter metamethod defined.

image

@centau centau added the bug Something isn't working label Jan 27, 2023
@vegorov-rbx
Copy link
Collaborator

type Iterable = typeof(setmetatable(
    {},
    {}::{
        __iter: (self: Iterable) -> () -> (number, string)
    }
))

local t: Iterable

for a, b in t do end

@andyfriesen
Copy link
Collaborator

This is fixed in the new solver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed by new solver This issue is confirmed to be fixed in the new solver. prioritized We plan to do this
Development

No branches or pull requests

4 participants