8000 Fix issue with not recognizing dialects in post-3.4.0 versions of Scala by jchyb · Pull Request #4241 · scalameta/scalameta · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix issue with not recognizing dialects in post-3.4.0 versions of Scala #4241

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 2 commits into from
May 14, 2025

Conversation

jchyb
Copy link
Contributor
@jchyb jchyb commented May 12, 2025

It looks like implicit vals in scala 3.3.x are unpickled into a methods, and in later versions they are unpickled into vals. To confirm that the imported dialect can be found in the proper package, we now just check whether it's a declaration there, regardless of it being a method or a val.

I did not add any regression tests here, as the problem appeared only in the scala versions not used in the build, so they would be ineffective here.

@jchyb jchyb force-pushed the fix-scala3-dialect-recognition branch from a9aeb38 to 50a3bbb Compare May 12, 2025 16:33
@jchyb jchyb changed the title Fix issue with not recognizing dialects in pos 3.4.0 versions of Scala Fix issue with not recognizing dialects in post-3.4.0 versions of Scala May 12, 2025
@jchyb jchyb force-pushed the fix-scala3-dialect-recognition branch from 50a3bbb to 0ad565a Compare May 12, 2025 16:34
It looks like implicit vals in scala 3.3.x are unpickled into a methods,
and in later version they are unpickled into vals. To confirm that the
imported dialect can be found in the proper package, we now just check
whether it's a declaration there, regardless of it being a method or
a val.
@jchyb jchyb force-pushed the fix-scala3-dialect-recognition branch from 0ad565a to 19b21a2 Compare May 12, 2025 16:34
@kitbellew
Copy link
Collaborator

I did not add any regression tests here, as the problem appeared only in the scala versions not used in the build, so they would be ineffective here.

in that case, I'd start by adding a newer scala version into the build, then a test that fails, then a fix showing that the test becomes successful.

@tgodzik
Copy link
Collaborator
tgodzik commented May 13, 2025

Let me add that separately.

@tgodzik
Copy link
Collaborator
tgodzik commented May 13, 2025

Ok, so if you switch to version 3.7.0 things don't even compile without this change. So instead I added Scala 3.7.0 to tests and run it as an additional case. Though there is some weirdness around sbt here, so might need to dig in a bit more

@tgodzik tgodzik force-pushed the fix-scala3-dialect-recognition branch from 56ddb28 to 7a0cfb8 Compare May 13, 2025 17:17
@tgodzik
Copy link
Collaborator
tgodzik commented May 13, 2025

Ok, tests seems to work. Without @jchyb fix it wouldn't actually even compile the tests

@@ -517,7 +518,8 @@ lazy val sharedSettings = Def.settings(
else List(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full))
},
scalacOptions ++= { if (isScala213.value) List("-Ymacro-annotations") else Nil },
scalacOptions ++= { if (isScala213or3.value) List("-Xfatal-warnings") else Nil },
scalacOptions ++=
{ if (isScala213or3.value && !isScala3Next.value) List("-Xfatal-warnings") else Nil },
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a bunch of migration warnings, that we don't want to change yet

@tgodzik tgodzik requested a review from kitbellew May 13, 2025 18:11
@kitbellew
Copy link
Collaborator

is this not something that could be tested, explicitly, first with typecheckError (like in quasiquotes/ErrorSuite), and then, after the fix, moved to DottySuccessSuite? if not, then lgtm.

@tgodzik
Copy link
Collaborator
tgodzik commented May 14, 2025

is this not something that could be tested, explicitly, first with typecheckError (like in quasiquotes/ErrorSuite), and then, after the fix, moved to DottySuccessSuite? if not, then lgtm.

We need to compile it with Scala 3.7.0 and it doesn't compile without the fix so there is not way to add the tests first unfortunately.

@tgodzik tgodzik merged commit ba68bda into scalameta:main May 14, 2025
20 checks passed
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.

3 participants
0