KEMBAR78
PEP 695: Add detection and error reporting for the use of incorrect expressions within the scope of a type parameter and a type alias by Eclips4 · Pull Request #17560 · python/mypy · GitHub
Skip to content

Conversation

Eclips4
Copy link
Member

@Eclips4 Eclips4 commented Jul 22, 2024

This fixes part of #15238:

Add detection and error reporting for use of assignment expressions, yield, yield from, and await expressions within the type parameter scope; see this section of PEP for details

@JelleZijlstra
Copy link
Member

This seems incomplete because it detects these cases only at the top level, not anywhere within the expression. For example, def f[x: (T + (yield 42))](): pass should also be flagged.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you need a recursive visitor for this.

@github-actions

This comment has been minimized.

@Eclips4 Eclips4 requested a review from sobolevn July 22, 2024 19:22
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Eclips4 Eclips4 requested a review from sobolevn July 22, 2024 20:18
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, one last nit :)

Co-authored-by: sobolevn <mail@sobolevn.me>
@github-actions

This comment has been minimized.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Congrats on your first mypy PR :)

I will leave it open for a couple of days for others to have a potential feedback.

@Eclips4 Eclips4 requested a review from JelleZijlstra July 23, 2024 18:43
@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@sobolevn sobolevn merged commit f2cee90 into python:master Jul 23, 2024
@Eclips4 Eclips4 deleted the more-detection-and-errors branch July 27, 2024 13:11
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.

3 participants