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

Only print ? for Scala 2 dialect if explicitly used #2759

Merged
merged 1 commit into from
May 23, 2022

Conversation

tgodzik
Copy link
Collaborator

@tgodzik tgodzik commented May 23, 2022

Previously, we would always print ? for the placeholder even if the Scala version wouldn't allow it. Now, we only print ? if it was explicitely used in the code.

Fixes #2751

The other solution would be introducing another dialect, but that would require a lot of people having to also change that, so it would require a lot more effort in the long run.

@tgodzik tgodzik force-pushed the fix-scala2-question branch 2 times, most recently from cc41aa3 to 529281b Compare May 23, 2022 15:26
check("new-dialect-scala213", "type T = List[_]", "type T = List[_]", newDialect = Some(dialects.Scala213))(
dialects.Scala211
)
check("new-dialect-scala213-from-scala3", "type T = List[?]", "type T = List[?]", newDialect = Some(dialects.Scala213))(
Copy link
Contributor

@kitbellew kitbellew May 23, 2022

Choose a reason for hiding this comment

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

i give up :) i am very bad at reviewing today. very sorry. please merge whenever you're ready.

i think i meant this test (original was underscore, not ?):

check("override-underscore-scala3-to-scala213", "type T = List[_]", "type T = List[?]")(dialects.Scala3)

it could also be

check("override-underscore-scala212-to-scala213", "type T = List[_]", "type T = List[?]")(dialects.Scala212)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The two examples will not work since the original code has _, so when printing in 212 or 213 we will not introduce ?. I think it's a correct logic in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, thank you. approved earlier.

Previously, we would always print `?` for the placeholder even if the Scala version wouldn't allow it. Now, we only print `?` if it was explicitely used in the code.

Fixes scalameta#2751

The other solution would be introducing another dialect, but that would require a lot of people having to also change that, so it would require a lot more effort in the long run.
@tgodzik tgodzik merged commit 7ad1c85 into scalameta:main May 23, 2022
@tgodzik tgodzik deleted the fix-scala2-question branch May 23, 2022 16:22
@blast-hardcheese
Copy link
Contributor

Confirmed this fixed my problem! Awesome work, really appreciate it!

@tgodzik
Copy link
Collaborator Author

tgodzik commented May 25, 2022

Confirmed this fixed my problem! Awesome work, really appreciate it!

Great to hear!

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.

Support for selectively overriding individual fields in Dialect
4 participants