Conversation
This comment has been minimized.
This comment has been minimized.
| def pair(x: U, y: V) -> Tuple[U, V]: ... | ||
| reveal_type(dec(id)) # N: Revealed type is "def [T] (x: T`2) -> builtins.list[T`2]" | ||
| reveal_type(dec(either)) # N: Revealed type is "def [T] (x: T`4, y: T`4) -> builtins.list[T`4]" | ||
| reveal_type(dec(id)) # N: Revealed type is "def [T] (x: T`3) -> builtins.list[T`3]" |
There was a problem hiding this comment.
Do you know why this changed?
There was a problem hiding this comment.
I have no idea to be honest. They changed in the original PR by sobolevn and I didn't know why. I'll do some more digging.
There was a problem hiding this comment.
Thanks. Not too important if it's hard to figure out, I assume these numbers can change based on all kinds of factors.
1df0dd2 to
7ffa87f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
JelleZijlstra
left a comment
There was a problem hiding this comment.
Almost there, added a suggestion for improving wording
| if self.defining_alias and self.has_type_params: | ||
| tvar_likes = self.find_type_var_likes(arg) | ||
| for name, tvar_expr in tvar_likes: | ||
| if (name, tvar_expr) not in self.allowed_alias_tvars: | ||
| self.fail( | ||
| f'Type variable "{name}" is not included in type_params', | ||
| arglist, | ||
| code=codes.VALID_TYPE, | ||
| ) | ||
| return None |
There was a problem hiding this comment.
Added this to handle Callable[[Unpack[Ts]], Ret] when Ts is not declared in the type parameters. It was causing a crash.
There was a problem hiding this comment.
I think I'll revert this part, I don't think it is the correct solution here.
There was a problem hiding this comment.
OK so looks like this already crashes on master with old aliases https://mypy-play.net/?mypy=master&python=3.12&gist=744b559e656f6f35cd5762bddf979038. I'll open an issue to track it.
Edit: #16937
This comment has been minimized.
This comment has been minimized.
|
Tests are failing, I think because the |
This is already the case. Maybe I’ll need to move the test to a Python 3.12+ test file? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Builds on top of and supersedes #16644