Skip to content

Iterable[list[int]] as type context is not handled well #1576

@AlexWaygood

Description

@AlexWaygood

Summary

In this snippet:

from typing import reveal_type, Iterable

x: Iterable[list[int]] = [[42], [56]]
reveal_type(x)

we currently reveal list[Unknown | list[Unknown | int]]. For comparison, mypy and pyrefly reveal Iterable[list[int]] and pyright reveals list[list[int]]. Either seems better than our current answer (though I like pyright's best!).

cc. @ibraheemdev

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 type

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions