Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 17, 2022

Based on #15191 by @gorilskij and enables support for #12991.

Fixes #8577
Fixes #12991
Fixes #15188

@nicolasstucki nicolasstucki force-pushed the fix-15191 branch 2 times, most recently from 6cbb190 to ee5283f Compare November 18, 2022 09:25
@nicolasstucki nicolasstucki marked this pull request as ready for review November 18, 2022 12:19
@nicolasstucki nicolasstucki changed the title Support inline inline unapplySeq and with leading given parameters Support inline unapplySeq and inline with leading given parameters Nov 18, 2022
@nicolasstucki nicolasstucki changed the title Support inline unapplySeq and inline with leading given parameters Support inline unapplySeq and with leading given parameters Nov 18, 2022
case TypeApply(_, targs) => targs
case _ => Nil
val unapplyInfo = sym.info match
case info: PolyType => info.instantiate(targs.map(_.tpe))
Copy link
Member

Choose a reason for hiding this comment

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

Why isn't this needed anymore? The comment above could maybe explain how type parameters are handled.

Choose a reason for hiding this comment

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

That's handled by fun.tpe.widen (line 202)

Copy link
Contributor Author

@nicolasstucki nicolasstucki Dec 7, 2022

Choose a reason for hiding this comment

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

I added a comment below and managed to simplify the leading implicits logic thanks to the use of fun.tpe.widen.

Now it even works with something as complex as

  extension [T] (using A)(inline ctx: Macro.StrCtx)(using B) inline def unapplySeq[U](using C)(inline input: T)(using D)(using F): Option[Seq[T]] = ???

* Fixes the computation of the inline unapply temporary unanimous unapply placeholder
* Handle leading given parameters in inline unapplies

Fixes scala#8577
Fixes scala#12991
Fixes scala#15188
@nicolasstucki nicolasstucki requested a review from smarter December 7, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants