From 76c810c86aac2633fed0b28ca4c84dd2e0cdcac3 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 28 Jan 2026 23:22:50 +0000 Subject: [PATCH] Update `Color` enum in `overloads_evaluation.py` to have >1 member This enum looks like it has two members, but it actually has only one, because `Color.RED` and `Color.BLUE` have the same value; `Color.BLUE` here is actually just an alias for `Color.RED`: ```pycon >>> from enum import Enum >>> class Color(Enum): ... RED = 1 ... BLUE = 1 ... >>> list(Color) [] >>> Color.RED is Color.BLUE True ``` ty is able to understand that, and this leads to ty failing the assertion a few lines below: https://github.com/python/typing/blob/b40321ce2037f67e1976e1b03a7766636ae54dc7/conformance/tests/overloads_evaluation.py#L160-L162 because it is able to infer that the second overload will never be taken, and therefore infers the more precise type of `Literal[0]` as a result of the `expand_enum()` call. I don't think that's what the assertion was trying to test, so this PR updates the enum to have >1 member. --- conformance/tests/overloads_evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conformance/tests/overloads_evaluation.py b/conformance/tests/overloads_evaluation.py index 518b864a..c89f9d0b 100644 --- a/conformance/tests/overloads_evaluation.py +++ b/conformance/tests/overloads_evaluation.py @@ -142,7 +142,7 @@ def check_expand_bool(v: bool) -> None: class Color(Enum): RED = 1 - BLUE = 1 + BLUE = 2 @overload