-
Notifications
You must be signed in to change notification settings - Fork 292
Labels
typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projectsv1-consider-addingTop-ranked but not in V1 milestone (consider adding)Top-ranked but not in V1 milestone (consider adding)
Description
Describe the Bug
Minimal repro:
from collections.abc import AsyncIterator
from typing import Literal, overload
class Patch:
pass
class FullState(Patch):
pass
@overload
async def astream(*, diff: Literal[True] = ...) -> AsyncIterator[Patch]: ... # pyrefly FP: inconsistent-overload
@overload
async def astream(*, diff: Literal[False]) -> AsyncIterator[FullState]: ... # pyrefly FP: inconsistent-overload
async def astream(*, diff: bool = True) -> AsyncIterator[Patch] | AsyncIterator[FullState]:
"""Stream results as either diffs or accumulated state.
When diff=True, yields Patch objects (valid for AsyncIterator[Patch]).
When diff=False, yields FullState objects (valid for AsyncIterator[FullState]).
Pyrefly incorrectly flags the Patch yield as incompatible with FullState.
"""
if diff:
patch = Patch()
yield patch # pyrefly FP: invalid-yield
else:
state = FullState()
yield stateSandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsUsability & readiness issues identified with running Pyrefly on top OSS projectsv1-consider-addingTop-ranked but not in V1 milestone (consider adding)Top-ranked but not in V1 milestone (consider adding)