Skip to content

Commit c037293

Browse files
authored
Merge pull request #11532 from griggt/fix-#7452
Fix #7452: Add regression test
2 parents 51c73b9 + 864d3d7 commit c037293

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/pos/i7452.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
trait Abstract[F[_], A] {
2+
type Out[G[_]]
3+
}
4+
object Abstract {
5+
type Aux[F[_], A, Out0[_[_]]] = Abstract[F, A] { type Out[G[_]] = Out0[G] }
6+
7+
implicit def valueAbstract[F[_], A]: Aux[F, F[A], [G[_]] =>> G[A]] = new Abstract[F, F[A]] {
8+
type Out[G[_]] = G[A]
9+
}
10+
11+
implicit def hkdAbstract[F[_], A[_[_]]]: Aux[F, A[F], [G[_]] =>> A[G]] = new Abstract[F, A[F]] {
12+
type Out[G[_]] = A[G]
13+
}
14+
}
15+
16+
case class StringF[F[_]](s: F[String])
17+
18+
trait Q[M[_[_]]] {
19+
def map[A, M2[_[_]]](f: M[Option] => A)(implicit abs: Abstract.Aux[Option, A, M2]): Q[M2]
20+
}
21+
22+
val q: Q[[F[_]] =>> F[String]] = ???
23+
val q2 = q.map(s => s) // was an error, now OK
24+
val q3 = q.map(s => StringF(s))

0 commit comments

Comments
 (0)