Skip to content

Unexpected conditional expression type inference change #7986

Closed
@JukkaL

Description

@JukkaL

#7955 caused this example to start generating type errors:

from typing import List, Union

def g(a: List[str], b: bool) -> bool:
    x = a and b
    y: bool
    return x or y  # Incompatible return value type (got "Union[List[str], bool]", expected "bool")

Previously, this generated no errors. It's unclear whether this fixed a false negative or whether this is a regression.

@Michael0x2a Do you have an idea of what might be going on?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions