Skip to content

Correct generic signature for intersection involving Array #12205

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 1 commit into from
May 11, 2021

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 23, 2021

We can't just check the class symbol since both Array[Int] and
Array[String] have the same symbol but different erasure.

Fixes #12204.

We can't just check the class symbol since both `Array[Int]` and
`Array[String]` have the same symbol but different erasure.

Fixes scala#12204.
@michelou
Copy link
Contributor

We can't just check the class symbol since both Array[Int] and
Array[String] have the same symbol but different erasure.

Fixes #12204.

@smarter Possible candidate for a RC4 or the timeline would be too short to get the 3.0.0-final out for Scalacon 2021 ?!

@smarter
Copy link
Member Author

smarter commented Apr 23, 2021

This is just about calls from Java and only an issue for a type whose only value is null, so not critical at all and not worth backporting.

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

While the fix works for the given example, there is also a mismatch when the array parameters are for value classes:

class A
class B

class VC1(val toStr: A) extends AnyVal
class VC2(val toInt: B) extends AnyVal

class Z {
  def ARRAY_132(x: Array[VC1] with Array[VC2]): Unit = {}
}

this produces a generic signature (x: A[]): void and descriptor (x: VC1[]): void

@bishabosha bishabosha assigned smarter and unassigned bishabosha May 10, 2021
@smarter
Copy link
Member Author

smarter commented May 10, 2021

Isn't that a special case of the separate issue #12189 ?

@bishabosha
Copy link
Member

Isn't that a special case of the separate issue #12189 ?

oh yeah you're right 😂

@bishabosha bishabosha merged commit 2004dc2 into scala:master May 11, 2021
@bishabosha bishabosha deleted the fix-array-gensig branch May 11, 2021 08:44
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
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.

java generic signature for Array intersection does not match erasedGlb
4 participants