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

Alternative definition layout of IArray #11329

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Feb 5, 2021

This PR changes the layout from

object opaques:
  opaque type IArray[+T] = Array[_ <: T]
  ... // extensions
end opaques

type IArray[+T] = opaques.IArray[T]

object IArray:
   ... // module methods
end IArray

to the following layout

package scala

opaque type IArray[+T] = Array[_ <: T]

object IArray:
  ... // extensions
  ... // module methods
end IArray

We lose the possibility of inlining the IArray.apply constructor methods. This PR handles those apply methods in the ArrayApply phase. This actually improved the bytecode generated.

This is a part of #11298

Migration

// IArray type
- scala.opaques.IArray
+ scala.IArray 

// extension methods: apply, length, take, ...
- scala.opaques.arrayOps.xyz
+ scala.IArray.xyz

@nicolasstucki nicolasstucki self-assigned this Feb 5, 2021
@nicolasstucki nicolasstucki force-pushed the alternative-definition-layout-of-IArray branch 4 times, most recently from f803d07 to b861cd4 Compare February 8, 2021 11:35
@nicolasstucki nicolasstucki added this to the 3.0.0-RC1 milestone Feb 8, 2021
@nicolasstucki nicolasstucki added the release-notes Should be mentioned in the release notes label Feb 8, 2021
@nicolasstucki nicolasstucki force-pushed the alternative-definition-layout-of-IArray branch 3 times, most recently from 01b8c9b to 6f1252a Compare February 9, 2021 09:07
@nicolasstucki nicolasstucki marked this pull request as ready for review February 9, 2021 10:19
@nicolasstucki nicolasstucki mentioned this pull request Feb 9, 2021
4 tasks
@nicolasstucki nicolasstucki force-pushed the alternative-definition-layout-of-IArray branch from 6f1252a to 12bc226 Compare February 10, 2021 10:37
@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Feb 10, 2021

Rebased - no conflicts

@odersky odersky assigned nicolasstucki and unassigned odersky Feb 10, 2021
@nicolasstucki nicolasstucki merged commit a27ffeb into scala:master Feb 10, 2021
@nicolasstucki nicolasstucki deleted the alternative-definition-layout-of-IArray branch February 10, 2021 11:56
@Kordyjan Kordyjan modified the milestones: 3.0.0-RC1, 3.0.0 Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants