Skip to content

[red-knot] Failed to narrow in nested function #17595

@dhruvmanila

Description

@dhruvmanila

Summary

Red knot fails to narrow in the following code:

def foo(x: str | None):
    def inner():
        if x is not None:
            # Red knot is not narrowing here
            reveal_type(x)  # revealed: str | None

    return inner

Version

00e73dc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtyMulti-file analysis & type inference

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions