Skip to content

Return type isn't inferred for nil-type blocks #868

Closed
@brson

Description

@brson
fn f<T>(g: block() -> T) -> T { g() }

fn main() {
    let x = f({ | | 10 });
    // No-worky - cannot determine a type for this expression
    f({ | | });
    // Also no-worky
    f({ | | ()});
    // Yeah-worky                                                                                                                                                             
    let _: () = f({ | | });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions