Skip to content

Fix Expr.{unlift, unliftOrError} and add missing Unliftables #9513

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
Aug 10, 2020

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Aug 7, 2020

  • Fix unlift to recive the most precise Unliftable.
    Previously we could not add Unliftable[List[T]] because the implicit search
    would fail with an ambigouity between Unliftable[List[T]] and Unliftable[List[T]].
    this came from the U >: T bound that was added to workarround the covariant T.
    As extension methods we can simply have the same T for the expression type and the
    unliftable type. This way, we also find the most precise T/Unliftable[T] available.
  • Add unliftable for Nil/List
  • Add unliftable for None/Some
  • Add unliftable for Map
  • Add unliftable for Set
  • Add unliftable for Left/Right
  • Add unliftable for EmptyTuple
  • Support -> in Tuple2

@nicolasstucki nicolasstucki self-assigned this Aug 7, 2020
@nicolasstucki nicolasstucki marked this pull request as ready for review August 7, 2020 15:36
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Can we update the commit message to detail what's the problem that is fixed?

Otherwise, LGTM

* Fix `unlift` to recive the most precise `Unliftable`.
  Previously we could not add `Unliftable[List[T]]` because the implicit search
  would fail with an ambigouity between `Unliftable[List[T]]` and `Unliftable[List[T]]`.
  this came from the `U >: T` bound that was added to workarround the covariant `T`.
  As extension methods we can simply have the same `T` for the expression type and the
  unliftable type. This way, we also find the most precise `T`/`Unliftable[T]` available.
* Add unliftable for `Nil`/`List`
* Add unliftable for `None`/`Some`
* Add unliftable for `Map`
* Add unliftable for `Set`
* Add unliftable for `Left`/`Right`
* Add unliftable for `EmptyTuple`
* Support `->` in `Tuple2`
@nicolasstucki nicolasstucki changed the title Fix Expr.{unseal, unsealOrError} and add missing Unliftables Fix Expr.{unlift, unliftOrError} and add missing Unliftables Aug 10, 2020
@nicolasstucki
Copy link
Contributor Author

@liufengyun I updated the commit message. I also meant unlift, not unseal.

@nicolasstucki nicolasstucki merged commit 7ae7f1f into scala:master Aug 10, 2020
@nicolasstucki nicolasstucki deleted the fix-unliftable branch August 10, 2020 13:03
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.

2 participants