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

Component out of order in a deconstruction pattern #4581

Open
kevinb9n opened this issue Sep 18, 2024 · 0 comments
Open

Component out of order in a deconstruction pattern #4581

kevinb9n opened this issue Sep 18, 2024 · 0 comments

Comments

@kevinb9n
Copy link
Contributor

kevinb9n commented Sep 18, 2024

Just capturing an idea; not sure if it is high-value. In something like

case MyRecord(int foo, _, var bar)

A warning could be issued if the name of any pattern variable (here, "foo" or "bar") has a shorter edit distance to some other component of the record than the one it is matched up with.

Positional APIs can be hard to remember. This applies to instanceof as well. Currently this only applies to record patterns, but in the future there may be deconstructors for non-record classes too.

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

No branches or pull requests

1 participant