class Base[*Ts]:
def encode(self, *values: *Ts) -> str:
raise NotImplementedError
class Child[*Ts](Base[*Ts]):
def encode(self, *values: *Ts) -> str: # <-- bad-override reported here
return "".join(str(v) for v in values)
ERROR Class member `Child.encode` overrides parent class `Base` in an inconsistent manner [bad-override]
--> repro_chain_override.py:7:9
|
7 | def encode(self, *values: *Ts) -> str: # <-- bad-override reported here
| ^^^^^^
|
`Child.encode` has type `(self: Child[*Ts], *values: *Ts) -> str`, which is not assignable to `(self: Child[*Ts], *values: *tuple[*Ts]) -> str`, the type of `Base.encode`
Signature mismatch:
expected: def encode(self: Child[*Ts], *values: *tuple[*Ts]) -> str: ...
^^^^^^^^^^ parameters
found: def encode(self: Child[*Ts], *values: *Ts) -> str: ...
^^ parameters
INFO 1 error
Describe the Bug
There seems to be some odd normalization of
*argsthat differs between parent and child classes when both are generic over aTypeVarTuple. As both have the exact same signature I don't expectbad-override.Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQBCtMA2gFQAqcAuovQMFDhI0WPETJU6TNlz5CxSIA66IZhhh6MdJVwaAFHBhQwAGnrsAbqigBXePy5wAlPQC0APnpwALgCd%2BJWCQ0LDwiLFVMX9UCGN6ADlcXwBJAFtiWHSdXxhMAFF-f1x-SPKKyqrqgWia%2BobGpsa65rb2js6JVWpaBgBhAAtoTA5uHgNmYzHeFyCuhcWloVb6DS0dPUNjUwtrWwc4J243Lx8AoIBiegAed3d6bFRMd1wrGGKIDXp-GGJSvKYeiDD4wZbgjqrIS-Xx2fxqZQgRGEABWuAg6CMAQMVjcYFK9Cs9AxhIO8BcIDMIDIvzAUFIhF8uHSUAo1wACqRafSfBgcAR6Hp0JAAOZw1C%2BCC4dCEVTXADKMDBg18vmIRwA9BqaZp6YRSiKNToNZhcJQ4BqhaLxZLpRr6PiyqgbNBUNhYILpdbYra1LhiL64LL0GRfINpe53v44FK1ABeeiIgDMhAAjAAmRGqVgfErRniqOzoCCZAH5dyYCC-SiS970BMAcggIvQpRgDdUrd87l%2BAEc7FXywBrGCkdyoSiUeAMRsAd1Q8I76BAAF8qRPazAAGLQGAUNBYPBEMiroA
(Only applicable for extension issues) IDE Information
No response