-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression in overload resolution picking eta-expanded method
- Loading branch information
Showing
6 changed files
with
79 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import scala.language.implicitConversions | ||
|
||
type UUID = String | ||
object MyId: | ||
def fromUUID[F[_]: Functor: UUIDGen]: F[String] = | ||
toFunctorOps(UUIDGen[F].randomUUID).map(fromUUID) // error | ||
private def fromUUID(id: UUID): String = ??? | ||
|
||
object UUIDGen: | ||
def apply[F[_]](implicit ev: UUIDGen[F]): UUIDGen[F] = ev | ||
trait UUIDGen[F[_]]: | ||
def randomUUID: F[UUID] | ||
|
||
trait Functor[F[_]] | ||
implicit def toFunctorOps[F[_], A](target: F[A])(implicit tc: Functor[F]): Ops[F, A] { type TypeClassType = Functor[F]} = | ||
new Ops[F, A] { type TypeClassType = Functor[F] } | ||
|
||
trait Ops[F[_], A] { | ||
type TypeClassType <: Functor[F] | ||
def map[B](f: A => B): F[B] = ??? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
trait ExMap1[K1, +V1] extends PartialFunction[K1, V1] | ||
trait ExMap2[K2, +V2] extends PartialFunction[K2, V2] | ||
|
||
trait Gen[L[_]] { def make: L[Unit] } | ||
|
||
trait Functor[M[_]]: | ||
def map[A, B](ma: M[A])(f: A => B): M[B] | ||
object Functor: | ||
implicit def inst1[K3]: Functor[[V3] =>> ExMap1[K3, V3]] = ??? | ||
implicit def inst2[K4]: Functor[[V4] =>> ExMap2[K4, V4]] = ??? | ||
|
||
class Test: | ||
def foo(x: Unit): String = x.toString() | ||
def foo[F[_]](using F: Functor[F], G: Gen[F]): F[String] = | ||
val res1: F[String] = F.map[Unit, String](G.make)(foo) // was: error | ||
val res2: F[String] = F.map[Unit, String](G.make)(foo(_)) // was: ok | ||
|
||
??? : F[String] |