Skip to content

Commit f09c9f3

Browse files
committed
Add fixed issue tests
1 parent 46f50a9 commit f09c9f3

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/pos/i7993.scala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
trait TC[F[_]]
2+
3+
object TC {
4+
def check[F[_], A](x: F[A])(implicit F: TC[F]): Unit = ()
5+
}
6+
7+
case class Foo[+E, +A](value: A)
8+
9+
object Foo {
10+
type WithList[+E, +A] = Foo[List[E], A]
11+
12+
implicit def instance[E]: TC[[x] =>> Foo[E, x]] =
13+
new TC[[x] =>> Foo[E, x]] {}
14+
}
15+
16+
val x1: Foo[List[String], Int] = Foo(1)
17+
val x2: Foo.WithList[String, Int] = Foo(1)
18+
19+
def test =
20+
TC.check(x1)
21+
TC.check(x2)

tests/pos/i8049.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import scala.language.implicitConversions
2+
3+
class Ops[A](a: A) {
4+
def bar: Unit = ()
5+
}
6+
7+
implicit def toOps[A](a: A): Ops[A] = new Ops[A](a)
8+
9+
type Id[A] = A
10+
11+
class Foo[A](val value: Id[A]) {
12+
def same: Foo[A] = new Foo[A](value)
13+
def map[B](f: A => B): Foo[B] = new Foo[B](f(value))
14+
}
15+
16+
val x: Int = 1
17+
val foo: Foo[Int] = new Foo(1)
18+
19+
val res1 = x.bar
20+
val res2 = foo.value.bar
21+
val res3 = foo.same.value.bar
22+
val res4 = foo.map[Int](_ + 1).value.bar
23+
val res5 = foo.map(_ + 1).value.bar

0 commit comments

Comments
 (0)