Skip to content

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Jul 26, 2023

This adds support for

[T1, ..., Tn] => ([erased] x1: X1, ..., [erased] xm: Xm) => r: R

Polymorphic function types with erased parameters are represented as using a refinement on PolyFunction. ErasedFunction is not needed.

PolyFunction { def apply[[T1, ..., Tn]]([given] [erased] x1: X1, ..., [erased] xm: Xm): R }
@nicolasstucki nicolasstucki requested a review from smarter July 26, 2023 11:51
@nicolasstucki nicolasstucki self-assigned this Jul 26, 2023
@nicolasstucki nicolasstucki force-pushed the poly-erased-functions branch 2 times, most recently from 11c0956 to 2fb1d1f Compare July 26, 2023 13:53
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

LGTM, I think we should also eventually drop ErasedFunction and only use PolyFunction for all refinements. /cc @natsukagami

@smarter
Copy link
Member

smarter commented Jul 26, 2023

One extra thing you might want to test is subtyping between lambda types, I assume (erased X) => Int and X => Int are not related by subtyping and the same holds for the polymorphic version.

This adds support for ```scala [T1, ..., Tn] => ([erased] x1: X1, ..., [erased] xm: Xm) => R ``` Polymorphic function types with erased parameters are represented as using a refinement on `PolyFunction`. `ErasedFunction` is not needed. ```scala PolyFunction { def apply[T1, ..., Tn]([erased] x1: X1, ..., [erased] xm: Xm): R } ```
@nicolasstucki nicolasstucki force-pushed the poly-erased-functions branch from 2fb1d1f to 5625107 Compare July 26, 2023 14:39
@nicolasstucki nicolasstucki merged commit 182331b into scala:main Jul 27, 2023
@nicolasstucki nicolasstucki deleted the poly-erased-functions branch July 27, 2023 06:57
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants