Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Router: for scala3, move NL before macro to after #3199

Merged
merged 2 commits into from
Apr 30, 2022

Conversation

kitbellew
Copy link
Collaborator

Fixes #3188.

@kitbellew kitbellew requested a review from tgodzik April 30, 2022 05:02
@@ -2599,6 +2599,13 @@ class Router(formatOps: FormatOps) {
case ft @ FormatToken(_: T.Comment, _, _) if ft.hasBreak =>
splitsAsNewlines(splits)
case ft if ft.meta.formatOff && ft.hasBreak => splitsAsNewlines(splits)
case FormatToken(_: T.Equals, r: T.KwMacro, _)
if dialect.allowInlineMods =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@tgodzik not sure if this is the right way to identify scala 3, perhaps as good as any

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use allowSignificantIndentation, because it's the cause of the issue. Without significant indentation there would be no issues

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Just a small comment, otherwise LGTM

@@ -2599,6 +2599,13 @@ class Router(formatOps: FormatOps) {
case ft @ FormatToken(_: T.Comment, _, _) if ft.hasBreak =>
splitsAsNewlines(splits)
case ft if ft.meta.formatOff && ft.hasBreak => splitsAsNewlines(splits)
case FormatToken(_: T.Equals, r: T.KwMacro, _)
if dialect.allowInlineMods =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use allowSignificantIndentation, because it's the cause of the issue. Without significant indentation there would be no issues

@kitbellew
Copy link
Collaborator Author

Just a small comment, otherwise LGTM

Done.

@kitbellew kitbellew merged commit c61538b into scalameta:master Apr 30, 2022
@kitbellew kitbellew deleted the 3188 branch April 30, 2022 14:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scalafmt 3.5.2 with scala3 dialect formats code that is not valid Scala 3
2 participants