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

Fix withDottyCompat in Scala Native #1738

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

lolgab
Copy link
Member

@lolgab lolgab commented Feb 7, 2022

Port of the workaround Scala Native is doing for Sbt in this PR: scala-native/scala-native#2553

@@ -224,6 +226,33 @@ trait ScalaNativeModule extends ScalaModule { outer =>
)
))
}

override def transitiveIvyDeps: T[Agg[Dep]] = T {
// TODO when in bin-compat breaking window: Change list to `super.transitiveIvyDeps()`
Copy link
Member

Choose a reason for hiding this comment

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

Is there any particular reason, why you can't use super.transitiveIvyDeps() in ScalaNativeModule?

Could you post the output of MiMa here? Maybe, it's only something macro related, which won't really affect any users? Just from looking at the code, it should not change anything, as we already override a def.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.
Here you find the output:

Scanning binary compatibility in /Users/lorenzo/scala/mill/out/scalanativelib/compile.dest/classes ...
[#0] Found 1 issue when checking against com.lihaoyi:mill-scalanativelib_2.13:0.10.0
[#0]  * abstract synthetic method mill$scalanativelib$ScalaNativeModule$$super$transitiveIvyDeps()mill.define.Target in interface mill.scalanativelib.ScalaNativeModule is present only in current version
   filter with: ProblemFilter.exclude[ReversedMissingMethodProblem]("mill.scalanativelib.ScalaNativeModule.mill$scalanativelib$ScalaNativeModule$$super$transitiveIvyDeps")
1 targets failed
scalanativelib.mimaReportBinaryIssues Failed binary compatibility check! Found 1 potential problems

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I really don't like the fact that we need to work around bin compat that way. On the other side, bin compat issues are real. So let us think a bit harder if there is no better solution here. Or alternatively, how we can ensure, we fix this code duplication once we create the next major version.

Copy link
Member Author

@lolgab lolgab Feb 7, 2022

Choose a reason for hiding this comment

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

We can have a standard comment to grep and fix before release, or a milestone with issues for these kind of problems. The problem with the latter is that we might have non-issues like this (they are not real issues but maintenance reminders) in the Issue tracker.

Copy link
Member

Choose a reason for hiding this comment

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

We could also create PRs, label them with bin-compat-breaker and assign them to next major milestone. Only downside would be, they clutter the PR view.

Copy link
Member

Choose a reason for hiding this comment

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

It could be an indicator for the next release then, if too many of them laying around. 😀

Copy link
Member

@lefou lefou Feb 7, 2022

Choose a reason for hiding this comment

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

I still wonder in which situations this issue will be a problem. I'm not an expert, but my suspicion is, that we won't see any issues at all. At least non, we won't get anyways. If a derived class/trait overrides this def, it should be no problem no super calls are necessary. And if it calls super, it has to search the hierarchy anyways. If the issue should be, that the previous super target (which is in javaModule) is fixed in the bytecode, won't it miss our new overridden def in any case? If anybody has some good example, I'm more than glad to learn something new.

Copy link
Member Author

@lolgab lolgab Feb 7, 2022

Choose a reason for hiding this comment

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

There is some explanation here: https://github.com/lightbend/mima/blob/b20f56d9af7543ecbf7c78fe997ca0cf4e3b2a69/core/src/main/scala/com/typesafe/tools/mima/lib/analyze/method/MethodChecker.scala#L124
But I can't understand it.
From my side, since the maintenance cost is not so high, I would leave the duplication, and have an open PR with a special label as you suggested.

@lolgab lolgab force-pushed the fix-withDottyCompat-scala-native branch from 1f6bfd5 to 6d1c4b8 Compare February 7, 2022 16:30
@lefou lefou merged commit 9ffb120 into com-lihaoyi:main Feb 7, 2022
@lefou lefou added this to the after 0.10.0 milestone Feb 7, 2022
@lefou
Copy link
Member

lefou commented Feb 7, 2022

Thanks @lolgab !

@lolgab lolgab deleted the fix-withDottyCompat-scala-native branch February 7, 2022 22:56
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