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

Typechecker doesn't propagate collection item type in for [each] #790

Closed
marijnh opened this issue Aug 1, 2011 · 1 comment
Closed

Typechecker doesn't propagate collection item type in for [each] #790

marijnh opened this issue Aug 1, 2011 · 1 comment

Comments

@marijnh
Copy link
Contributor

marijnh commented Aug 1, 2011

Both of these loops don't typecheck, although it should be deducable what the type of u is:

iter x() -> int {
    put 1;
    put 2;
}

fn main() {
    for each u in x() {
        log_err u == 1;
    }
    for u in ~[1, 2, 3] {
        log_err u == 2;
    }
}
@marijnh
Copy link
Contributor Author

marijnh commented Aug 1, 2011

(Interestingly, the code looks like it is doing the right thing in this case.)

@marijnh marijnh closed this as completed in 2d5b651 Aug 2, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
Added missing comma to Unions reference
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant