Skip to content

Pyrefly loses Any/Unknown when calling abs #5413

Open

Description

@superbobry

Describe the Bug

Reporoducer:

from typing import reveal_type


def f(x): return x


def test():
  x = f(42) or 1
  reveal_type(x)  # int | Unknown
  reveal_type(abs(x))  # int

This also reproduces when f is annotated to return Any.

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.I6HIRCtnoIlVo0LTCpZUKhDiIOs1IKmpAujwNA0TI00FYLwZgkSQTAJqRxdJTCoGimpihq-yQgBEQAHqVGDJAoyY9FJg-QUMcL2YPGVg0ZWqkFFSUlBspa8P055flK6fmqefkp9crI-iQ18BlJQSyxIzwaUiqnEK-eD0UAw0lpKIVYfEqzq-aFUHxSpQBd6YAgA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    googleissues from google

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions