Concatenate not handled in function with generic class as parameter.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
When wrapping a generic class while using Concatenate to remove an arg from the ParamSpec, pyrefly fails to assign the input ParamSpec to the Concatenated spec.
```python
from typing import Concatenate, reveal_type
class A[**P]:
pass
class B[**P]:
pass
def transform[**P](arg: A[Concatenate[int, P]]) -> B[P]:
raise NotImplementedError
a1: A[[int]] = A()
# ERROR sandbox.py:14:23-25: Argument `A[[int]]` is not assignable to parameter `arg` with type `A[Concatenate[int, P]]` in function `transform` [bad-argument-type]
reveal_type(transform(a1))
# expected: B[[]]
# revealed: B[@_]
a2: A[[int, str, int]] = A()
# ERROR sandbox.py:20:23-25: Argument `A[[int, str, int]]` is not assignable to parameter `arg` with type `A[Concatenate[int, P]]` in function `transform` [bad-argument-type]
reveal_type(transform(a2))
# expected: B[[str, int]]
# revealed: B[@_]
```
This superficially seems similar to #3706, I'm filing a separate issue because I don't know pyrefly internals well enough to assume they are or are not actually related.
### Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN0BhXOgDGqBjHTiYAGjqUYANxiooAfSbEYAHXS6RUVHDh0AggG0AVJYAKAXUS66zusSNxd%2Bw8boAhK7YOTi5uxp5YMGCMlBhwYLw0AfYAFKiUbIhm5kKi0lIS5qwMcvZ2AJR0ALQAfH7m9o7oLvKoEHAwdAByuAwAktywNJISmACilNSU4agAjJkWhegMdnZ0ALxmyWW6AMR0owBKBwDyB3RoWHhEZIgzACyIAEwAzJWPAKzz6QCuQ0t0AAMFkUVgDOCZ0D06O4IGwpNhYIxcK40qghhJKIC0mwwQB3CAMAAWjGYHSB2WEYgk%2BRgi2KdFKYNYdDA31EDAgwkBDBi6DiCTB5mwqEwlWxv2GlU0MDsugUylUGlJyR5sXilBoqRmZW26D2MHwWhEI0y-nMK128iUKlgmFN5gAAmpZXopI95uY6XI4Dy5CDVhtTFtLYcTmcLjgCCRSE8AAxPV4fL5sCX-cle86%2BzhLUHguiQ-gwuGoBEdBjItwxdEwTEA7F4gnE6WAiw5KmSaQZxnZlls42cpoA1V89U0QXC0Xiv4MKWkl3ym1KrQq3n8jWpR46y0Go0murmH2UP05l17BeqGB2upOuwgGQgMgKMBQUiEcs0KAUPY2UhPl-nDBI3wOgRGESAUxiDlhEIS0AGUYA6QkGAYYg4EQAB6dDH0iF9CF4Nh0MkdDMFwEQ4HQ0D0HA75IIHdCWV4aFFFaQxSxAsDYRo8QBzoXBiCgvkYPQMgiWESplEoOAeI2bQQGeQh7lk3RzBrSY4BdNkuB4PhL0qTAIAUftlHWOgAHJYUhBRTN0AtKgUABHb4DN0gBrGBSDFEQRHgEwNlM3E0nQUyQAAX3vVAjJgAAxaAYAoCMrmjUKgA
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.