Summary
ty appears to infer inconsistent types for abs(size) depending on whether the same float annotation appears on a function parameter or a module-level variable.
Playground: https://play.ty.dev/1f3fa1f1-b2ca-4d4d-8cde-05e7adfc1291
Minimal reproduction:
from typing import reveal_type
def fn(size: float):
size_ = abs(size)
reveal_type(size_) # ty: Unknown
size: float = 1.0
size_ = abs(size)
reveal_type(size_) # ty: int | float
Command:
Actual output with ty 0.0.32:
reveal_type(size_) # inside function: Unknown
reveal_type(size_) # module scope: int | float
Version
ty 0.0.32 (4d1e1fc 2026-04-20)
Summary
tyappears to infer inconsistent types forabs(size)depending on whether the samefloatannotation appears on a function parameter or a module-level variable.Playground: https://play.ty.dev/1f3fa1f1-b2ca-4d4d-8cde-05e7adfc1291
Minimal reproduction:
Command:
ty check repro.pyActual output with
ty 0.0.32:Version
ty 0.0.32 (4d1e1fc 2026-04-20)