Skip to content

support multi step bi-directional type inference #1211

@KotlinIsland

Description

@KotlinIsland

Summary

def f1() -> list[object]:
    return [1, 2, 3]  # lovely, bidirectional type inference uses the return type to infer `list[object]`

def f2() -> list[object]:
    result = [1, 2, 3]
    return result  # error: bi-directional type inference does not look ahead, so the inferred type is `list[int]`

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bidirectional inferenceInference of types that takes into account the context of a declared type or expected typegenericsBugs or features relating to ty's generics implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions