Skip to content

Refuse trailing type parameters in extractors #22699

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

mbovel
Copy link
Member

@mbovel mbovel commented Mar 3, 2025

This PR restrict selection of extractors to ignore methods that have trailing type parameters, as application of these can't be represented with tpd.UnApply. Fixes #22550.

Note: it was discussed during the compiler meeting of 2025-02-26 that unapply methods (and other magic methods) should not be linted at definition site, like the first version of this PR did. Instead, non-conforming extractors should crash at use site. This is what this second version implements.

Copy link
Contributor

@kyouko-taiga kyouko-taiga left a comment

Choose a reason for hiding this comment

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

LGTM.

I maintain for the record that I believe we're not helping users by accepting a definition of unapply with the "inappropriate" signature but I like the quality of the error message.

@mbovel mbovel changed the title Refuse trailing types parameters in extractors Refuse trailing type parameters in extractors Mar 4, 2025
@odersky odersky merged commit 02306bb into scala:main Apr 23, 2025
29 checks passed
@odersky odersky deleted the mb/22550b branch April 23, 2025 14:03
@WojciechMazur WojciechMazur added this to the 3.7.1 milestone May 1, 2025
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.

Compiler crash with custom unapply method
5 participants