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

Help wanted: unexpected failures of binary checking when updating to Scala 2.13.9 #723

Closed
danicheg opened this issue Sep 22, 2022 · 10 comments

Comments

@danicheg
Copy link

Can you please help to check whether those failures in various libraries when updating Scala to 2.13.9 are expected or if there is an issue in the Mima tool? Thanks!
#1

[error] log4cats-core: Failed binary compatibility check against org.typelevel:log4cats-core_sjs1_2.13:2.5.0 (e:info.versionScheme=early-semver)! Found 2 potential problems
[error]  * extension static method productIterator$extension(java.lang.String)scala.collection.Iterator in class org.typelevel.log4cats.LoggerName does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("org.typelevel.log4cats.LoggerName.productIterator$extension")

#2

[error] monoids: Failed binary compatibility check against org.typelevel:monoids_2.13:0.2.0 (e:info.versionScheme=early-semver)! Found 28 potential problems
[error]  * extension static method productIterator$extension(Boolean)scala.collection.Iterator in class org.typelevel.monoids.All does not have a correspondent in current version
[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("org.typelevel.monoids.All.productIterator$extension")
[error]  * extension method productIterator$extension(Boolean)scala.collection.Iterator in object org.typelevel.monoids.All does not have a correspondent in current version
@SethTisue
Copy link
Collaborator

The relevant PR is scala/scala#10002

@SethTisue
Copy link
Collaborator

@som-snytt @lrytz I haven't had time yet to ponder this. Is there any scenario in which the no-longer-generated methods could be called from code generated by an older compiler?

@som-snytt
Copy link
Contributor

som-snytt commented Sep 22, 2022

A case class extending AnyVal had product methods:

  public static java.lang.String productElementName$extension(java.lang.String, int);
  public static scala.collection.Iterator<java.lang.Object> productIterator$extension(java.lang.String);
  public static java.lang.Object productElement$extension(java.lang.String, int);
  public static int productArity$extension(java.lang.String);
  public static java.lang.String productPrefix$extension(java.lang.String);
  public scala.collection.Iterator<java.lang.String> productElementNames();
  public java.lang.String productPrefix();
  public int productArity();
  public java.lang.Object productElement(int);
  public scala.collection.Iterator<java.lang.Object> productIterator();
  public java.lang.String productElementName(int);

where productElementNames lacks an extension method and would therefore always box.

Now productIterator also lacks an $extension method for some reason. (Presumably, the reason is that methods inherited from a trait don't get the value class treatment.)

Product extends Any is a universal trait.

This is clearly a problem.

@SethTisue
Copy link
Collaborator

SethTisue commented Sep 22, 2022

I'm also wondering about a meta-issue here: why didn't this crop up in scala/scala itself, which uses MiMa? (If not when the PR landed, then at least when 2.13.9 became the reference compiler?)

@som-snytt
Copy link
Contributor

som-snytt commented Sep 22, 2022

How many case classes extend AnyVal? [Edited, thanks.]

@SethTisue
Copy link
Collaborator

SethTisue commented Sep 22, 2022

How many case classes extend Any?

This is about extends AnyVal, iiuc — as in, value classes. (By default, case classes extend AnyRef.)

@danicheg
Copy link
Author

How many case classes extend AnyVal?

If you're asking me, well, that pattern is used quite frequently. https://github.com/search?l=Scala&q=extends+AnyVal&type=Code

@SethTisue
Copy link
Collaborator

Let's continue at scala/bug#12650 , since it appears that MiMa is functioning as expected, here.

@SethTisue
Copy link
Collaborator

We will be releasing Scala 2.13.10 soon with a fix for the regression; you can follow progress on the release at https://contributors.scala-lang.org/t/scala-2-13-10-release-planning/5943

@danicheg
Copy link
Author

danicheg commented Oct 9, 2022

Good to hear that. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants