Skip to content

Fix #8349: Generic signatures of generic arrays #8361

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
Mar 3, 2020

Conversation

smarter
Copy link
Member

@smarter smarter commented Feb 22, 2020

When T[] is erased to Object, it should get a Java generic signature of
Object and not of T<>. Fixed by reusing the same logic we have in
TypeErasure which replaces a bunch of weird code imported from scalac.

The new behavior differs in one case from scalac: Array[_ <: Byte]
gets a generic signature of byte[] instead of Object, but this is
consistent with how we handle erasure (which I think is OK because as
far as I can tell, we can't construct a value of type Array[Nothing]
with Dotty).

@smarter smarter requested a review from odersky February 22, 2020 20:44
@nicolasstucki nicolasstucki linked an issue Feb 24, 2020 that may be closed by this pull request
@smarter smarter requested review from anatoliykmetyuk and removed request for odersky February 29, 2020 13:43
@smarter smarter assigned anatoliykmetyuk and unassigned odersky Feb 29, 2020
Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk left a comment

Choose a reason for hiding this comment

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

Looks like the mill tests are still running on this branch. You should rebase it to master where these tests are disabled so that the community build passes.

When T[] is erased to Object, it should get a Java generic signature of
Object and not of T<>. Fixed by reusing the same logic we have in
TypeErasure which replaces a bunch of weird code imported from scalac.

The new behavior differs in one case from scalac: `Array[_ <: Byte]`
gets a generic signature of `byte[]` instead of `Object`, but this is
consistent with how we handle erasure (which I think is OK because as
far as I can tell, we can't construct a value of type `Array[Nothing]`
with Dotty).
@smarter smarter merged commit aea5f3c into scala:master Mar 3, 2020
@smarter smarter deleted the fix-array-sig branch March 3, 2020 12:15
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.

Signature of method taking generic array differs from Scala 2
3 participants