Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug that resulted in a false positive when an expression of t… #5532

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

erictraut
Copy link
Collaborator

…ype type[Self] was used as the base type for a member access expression that was then used to call an instance method on that class. This addresses #5530.

…ype `type[Self]` was used as the base type for a member access expression that was then used to call an instance method on that class. This addresses #5530.
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+   /tmp/mypy_primer/projects/steam.py/steam/chat.py:205:32 - error: Argument of type "GroupChannel | ClanChannel" cannot be assigned to parameter "channel" of type "Channel[Self@ChatMessage[AuthorT@ChatMessage, MemberT@ChatMessage]]" in function "__init__"
+     Type "GroupChannel | ClanChannel" cannot be assigned to type "Channel[Self@ChatMessage[AuthorT@ChatMessage, MemberT@ChatMessage]]"
+       "ClanChannel" is incompatible with "Channel[Self@ChatMessage[AuthorT@ChatMessage, MemberT@ChatMessage]]"
+         Type parameter "MessageT@Channel" is covariant, but "ClanMessage[PartialMember | ClanMember]" is not a subtype of "Self@ChatMessage[AuthorT@ChatMessage, MemberT@ChatMessage]" (reportGeneralTypeIssues)
+   /tmp/mypy_primer/projects/steam.py/steam/message.py:75:32 - error: Argument of type "UserChannel" cannot be assigned to parameter "channel" of type "Channel[Self@UserMessage[UserMessageAuthorT@UserMessage]]" in function "__init__"
+     "UserChannel" is incompatible with "Channel[Self@UserMessage[UserMessageAuthorT@UserMessage]]"
+       Type parameter "MessageT@Channel" is covariant, but "UserMessage[User | Friend | ClientUser]" is not a subtype of "Self@UserMessage[UserMessageAuthorT@UserMessage]" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/models.py:187:20 - error: Could not bind method "(unnamed)" because "type[_IOMixin]" is not assignable to parameter "self"
-     Type "type[Self@_IOMixin]" cannot be assigned to type "Self@_IOMixin" (reportGeneralTypeIssues)
- 8666 errors, 45 warnings, 0 informations 
+ 8667 errors, 45 warnings, 0 informations 

@erictraut erictraut merged commit d7b0a85 into main Jul 18, 2023
10 checks passed
@erictraut erictraut deleted the issue5530 branch July 18, 2023 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants