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

[syntax-errors] Type parameter defaults before Python 3.13 #16447

Merged
merged 5 commits into from
Mar 4, 2025

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Feb 28, 2025

Summary

Detects the presence of a PEP 696 type parameter default before Python 3.13.

Test Plan

New inline parser tests for type aliases, generic functions and generic classes.

@ntBre ntBre added the preview Related to preview mode features label Feb 28, 2025
Copy link
Contributor

github-actions bot commented Feb 28, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Summary
--

Detects the presence of a [PEP 696] type parameter default before Python 3.13.

Test Plan
--

New inline parser tests for type aliases, generic functions and generic classes.

[PEP 696]: https://peps.python.org/pep-0696/#grammar-changes
@ntBre ntBre force-pushed the brent/syn-type-param-default branch from e551aa2 to f79f77c Compare March 2, 2025 21:31
@dhruvmanila dhruvmanila added the parser Related to the parser label Mar 3, 2025
@ntBre
Copy link
Contributor Author

ntBre commented Mar 3, 2025

Thanks! I restricted the diagnostic range to the = ... part, updated the wording of the message, and also threw in a test case with a non-default parameter and a second default parameter just to make sure the ranges still worked. I think the more precise range looks a lot better.

@ntBre ntBre enabled auto-merge (squash) March 4, 2025 16:50
@ntBre ntBre merged commit e7b93f9 into main Mar 4, 2025
20 checks passed
@ntBre ntBre deleted the brent/syn-type-param-default branch March 4, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Related to the parser preview Related to preview mode features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants