-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
Description
Describe the Bug
I suspect this is caused by #2080, because the issue is only reproducible when the property of an enum matches on self (and I have to suppress these errors).
Reproducer:
import enum
class A(enum.Enum):
FOO = "FOO"
@property
def p(self) -> int: # pyrefly: ignore[bad-return]
match self: # pyrefly: ignore[non-exhaustive-match]
case A.FOO: return 42
def test(a: A) -> int:
return a.p // 2
Ouput:
ERROR `//` is not supported between `Literal[A.p]` and `Literal[2]` [unsupported-operation]
--> /tmp/foo.py:13:10
|
13 | return a.p // 2
| ^^^^^^^^
|
Argument `Literal[A.p]` is not assignable to parameter `value` with type `int` in function `int.__rfloordiv__`
Note that A.p is not a real literal type.
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable