ruff
11272cf4 - [ty] Preserve type context kind when propagating to nested expressions (#30280)

Commit
1 day ago
[ty] Preserve type context kind when propagating to nested expressions (#30280) The `TypeContextKind` of a given `TypeContext` should be preserved when propagated to a nested expression. For example, an upper bound `T: Payload` does not provide a solver preference for gradual types, and so should not provide a preference to any fields of the `TypedDict`: ```py from typing import TypedDict, Any class Payload(TypedDict): value: int def payload[T: Payload](value: T) -> T: return value def identity[T](value: T) -> T: return value def _(value: Any): payload(reveal_type(identity(value))) # revealed: Any payload({"value": reveal_type(identity(value))}) # main: int, now: Any ``` There are a few places where we are incorrectly constructing a `TypeContext` with the default `TypeContextKind` instead of preserving it from the outer `TypeContext`, which this PR fixes.
Author
Parents
Loading