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

Patch empty implicit parens on error recovery #22835

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

Offer a rewrite for an erroneous application f() where the parameter list is implicit and a parameter lacks a default arg.

This was never official syntax, but was accepted from 3.3.4/3.4.2 due to a bug. The rewrite is for 3.7-migration, using the existing MigrationVersion.ImplicitParamsWithoutUsing, since that is a similar bit of syntax.

Fixes #22792

@som-snytt
Copy link
Contributor Author

som-snytt commented Mar 19, 2025

Requires a tweak: an implicit param list is not supplied implicitly if an arg list is present (but defaults may be supplied in the explicit application). It must not continue implicit application when rewriting.

Ha, in other words, canApplyImplicits should be false not true. I knew it had to be one of the two.

@som-snytt som-snytt force-pushed the issue/22792-rewrite-bad-parens branch from 6fe89ef to cfa8e9f Compare March 19, 2025 16:08
@som-snytt
Copy link
Contributor Author

Added a test case for rewrite of Foo()() to Foo() instead of Foo().apply. That is a "big TODO".

@som-snytt som-snytt marked this pull request as ready for review March 21, 2025 18:28
@Gedochao Gedochao requested a review from KacperFKorban March 24, 2025 06:55
@som-snytt som-snytt force-pushed the issue/22792-rewrite-bad-parens branch from c184805 to 83fda42 Compare March 29, 2025 21:46
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.

Change to implicit method invocation should define a migration rewrites
2 participants