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

ScalafmtRunner: fix handling of trait "extends" #1940

Merged
merged 3 commits into from
May 2, 2020

Conversation

kitbellew
Copy link
Collaborator

@kitbellew kitbellew commented May 1, 2020

As it stands, using any dialect with allowTraitParameters = false leads to a problem (including Scala211, Scala212 and even Scala213), and only default and Dotty dialects work correctly.

Our code, in multiple places, expects the extends keyword to be owned by the trait tree whereas for older dialects scalameta assigns it to Name.Anonymous (which is owned by Init and only then the trait).

For formatting purposes, we can leave it to the user's scalac to determine whether this specific feature (allowTraitParameters) should be supported; enabling for formatting purposes only doesn't change how the code is parsed when this feature is not used.

@kitbellew kitbellew requested review from olafurpg, poslegm and tgodzik May 1, 2020 19:18
@kitbellew kitbellew merged commit 5d773a8 into scalameta:master May 2, 2020
@kitbellew kitbellew deleted the 1940 branch May 2, 2020 15:15
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.

2 participants