ruff
96b27a70 - [ty] Only perform literal promotion for implicitly inferred literals (#23107)

Commit
76 days ago
[ty] Only perform literal promotion for implicitly inferred literals (#23107) Updates our literal promotion heuristics to only promote implicitly inferred literal values, i.e., literal values inferred without an explicit literal annotation. This requires us to track promotability on the literal value type itself, and so a lot of the changes here are churn from having to split the literal value variants of `Type` into a separate `LiteralValue` type. Another consequence of this change is that the same literal value does not compare equal in its promotable and unpromotable form, so there are a few cases where we relied on type equality (or hashing) that need to be changed. Resolves https://github.com/astral-sh/ty/issues/2664, https://github.com/astral-sh/ty/issues/1815, and supersedes https://github.com/astral-sh/ruff/pull/22322.
Author
Parents
Loading