Skip to content

Fix array creation v2 #254

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
Dec 1, 2014
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 28, 2014

Now: All new Array[T] methods are translated to calls of the form

dotty.Arrays.newXYZArray ...

Supersedes #252. Main change is that we now keep ref array types after erasure, and that we
allow for local type inference of array creation arguments, i.e. new Array(len), without a type argument.

Review by @DarkDimius please.

Now: All new Array[T] methods are translated to calls of the form

    dotty.Arrays.newXYZArray ...
@odersky odersky changed the title Previous scheme was buggy; leaked Array types to backend. Fix array creation v2 Nov 28, 2014
DarkDimius added a commit that referenced this pull request Dec 1, 2014
@DarkDimius DarkDimius merged commit 5ff3d0f into scala:master Dec 1, 2014
/** Create an array of type T. T must be of form Array[E], with
* E being a reference type.
*/
def newRefArray[T](length: Int): T = ???
Copy link
Contributor

Choose a reason for hiding this comment

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

Is return type T instead of Array[T] here intentional?

Copy link
Member

Choose a reason for hiding this comment

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

From the comment: "T must be of form Array[E]". So yes, I suppose it is intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's intentional. It's a technically to fit best with the way erasure works for polymorphic functions. That way, we can treat newRefArray and asInstanceOf in exactly the same way.

@allanrenucci allanrenucci deleted the fix/newArray-v2 branch December 14, 2017 19:22
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "Fix issue with static `this` references erroring in quoted code" to 3.3 LTS
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