Skip to content

[red-knot] Add support for unpacking targets in with statement #16365

@dhruvmanila

Description

@dhruvmanila

Description

For example:

class Unpacked:
    def __enter__(self) -> tuple[int, int]:
        return (1, 2)

    def __exit__(self, exc_type, exc_value, exc_tb):
        return


with Unpacked() as (x, y):
    reveal_type(x)  # revealed: int
    reveal_type(y)  # revealed: int

Metadata

Metadata

Labels

help wantedContributions especially welcometyMulti-file analysis & type inference

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions