Commit 76c810c
authored
Update
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: 1>]
>>> 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.Color enum in overloads_evaluation.py to have >1 member1 parent b40321c commit 76c810c
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
0 commit comments