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 an incorrect type evaluation when access… #6419

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

erictraut
Copy link
Collaborator

…ing a property that returns Self or type[Self].

…ing a property that returns `Self` or `type[Self]`.
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:201:31 - warning: Unnecessary "# type: ignore" comment
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:259:20 - error: Expression of type "Flags" cannot be assigned to return type "Self@Flags"
-     Type "Flags" cannot be assigned to type "Self@Flags" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:261:20 - error: Expression of type "Flags" cannot be assigned to return type "Self@Flags"
-     Type "Flags" cannot be assigned to type "Self@Flags" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:267:20 - error: Expression of type "Flags" cannot be assigned to return type "Self@Flags"
-     Type "Flags" cannot be assigned to type "Self@Flags" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:269:20 - error: Expression of type "Flags" cannot be assigned to return type "Self@Flags"
-     Type "Flags" cannot be assigned to type "Self@Flags" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:2132:16 - error: Expression of type "UserNewsType" cannot be assigned to return type "Self@UserNewsType"
-     Type "UserNewsType" cannot be assigned to type "Self@UserNewsType" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/enums.py:2137:16 - error: Expression of type "UserNewsType" cannot be assigned to return type "Self@UserNewsType"
-     Type "UserNewsType" cannot be assigned to type "Self@UserNewsType" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/manifest.py:249:32 - error: Argument of type "ManifestPath" cannot be assigned to parameter "__object" of type "Self@ManifestPath" in function "append"
-     Type "ManifestPath" cannot be assigned to type "Self@ManifestPath" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/steam.py/steam/role.py
-   /tmp/mypy_primer/projects/steam.py/steam/role.py:121:16 - error: Expression of type "RolePermissions" cannot be assigned to return type "Self@RolePermissions"
-     Type "RolePermissions" cannot be assigned to type "Self@RolePermissions" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/ext/commands/bot.py:220:39 - error: Argument of type "Cog[Bot]" cannot be assigned to parameter "cog" of type "Cog[Self@Bot]" in function "remove_cog"
-     "Cog[Bot]" is incompatible with "Cog[Self@Bot]"
-       Type parameter "BotT@Cog" is covariant, but "Bot" is not a subtype of "Self@Bot"
-         Type "Bot" cannot be assigned to type "Self@Bot" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/steam.py/steam/ext/commands/bot.py:294:39 - error: Argument of type "Cog[Bot]" cannot be assigned to parameter "cog" of type "Cog[Self@Bot]" in function "remove_cog"
-     "Cog[Bot]" is incompatible with "Cog[Self@Bot]"
-       Type parameter "BotT@Cog" is covariant, but "Bot" is not a subtype of "Self@Bot"
-         Type "Bot" cannot be assigned to type "Self@Bot" (reportGeneralTypeIssues)
- 8421 errors, 22 warnings, 0 informations 
+ 8411 errors, 23 warnings, 0 informations 

discord.py (https://github.com/Rapptz/discord.py)
- /tmp/mypy_primer/projects/discord.py/discord/abc.py
-   /tmp/mypy_primer/projects/discord.py/discord/abc.py:975:16 - error: Expression of type "GuildChannel" cannot be assigned to return type "Self@GuildChannel"
-     Type "GuildChannel" cannot be assigned to type "Self@GuildChannel" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/discord.py/discord/embeds.py
-   /tmp/mypy_primer/projects/discord.py/discord/embeds.py:252:16 - error: Expression of type "Embed" cannot be assigned to return type "Self@Embed"
-     Type "Embed" cannot be assigned to type "Self@Embed" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/discord.py/discord/ext/commands/cooldowns.py
-   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/cooldowns.py:251:16 - error: Expression of type "MaxConcurrency" cannot be assigned to return type "Self@MaxConcurrency"
-     Type "MaxConcurrency" cannot be assigned to type "Self@MaxConcurrency" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/core.py:618:48 - error: Argument of type "Command[CogT@Command, P@Command, T@Command]" cannot be assigned to parameter "other" of type "Self@Command[CogT@Command, P@Command, T@Command]" in function "_ensure_assignment_on_copy"
-     Type "Command[CogT@Command, P@Command, T@Command]" cannot be assigned to type "Self@Command[CogT@Command, P@Command, T@Command]" (reportGeneralTypeIssues)
-   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/core.py:625:52 - error: Argument of type "Command[CogT@Command, P@Command, T@Command]" cannot be assigned to parameter "other" of type "Self@Command[CogT@Command, P@Command, T@Command]" in function "_ensure_assignment_on_copy"
-     Type "Command[CogT@Command, P@Command, T@Command]" cannot be assigned to type "Self@Command[CogT@Command, P@Command, T@Command]" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/discord.py/discord/ext/commands/help.py
-   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/help.py:377:16 - error: Expression of type "HelpCommand" cannot be assigned to return type "Self@HelpCommand"
-     Type "HelpCommand" cannot be assigned to type "Self@HelpCommand" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/discord.py/discord/ext/commands/parameters.py
-   /tmp/mypy_primer/projects/discord.py/discord/ext/commands/parameters.py:138:16 - error: Expression of type "Parameter" cannot be assigned to return type "Self@Parameter"
-     Type "Parameter" cannot be assigned to type "Self@Parameter" (reportGeneralTypeIssues)
- 69 errors, 9 warnings, 0 informations 
+ 62 errors, 9 warnings, 0 informations 

@erictraut erictraut merged commit 04e94bd into main Nov 11, 2023
@erictraut erictraut deleted the propSelf branch November 11, 2023 08:00
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.

1 participant