Skip to content

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

Closed
@marijnh

Description

@marijnh

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;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions