From 91f067143c9564a052058fa02c73ae6cde3020e6 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 15 Jul 2016 15:14:38 +0200 Subject: Add tests Adds the original test form #1381. t2660 looks similar. Also adds some unrelated tests I had in the queue that now compile. --- tests/pos/hkgadt.scala | 9 +++++++++ tests/pos/i618.scala | 3 +++ tests/pos/overloaded.scala | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/pos/hkgadt.scala create mode 100644 tests/pos/i618.scala diff --git a/tests/pos/hkgadt.scala b/tests/pos/hkgadt.scala new file mode 100644 index 000000000..ac8caa6f3 --- /dev/null +++ b/tests/pos/hkgadt.scala @@ -0,0 +1,9 @@ +object HKGADT { + sealed trait Foo[F[_]] + final case class Bar() extends Foo[List] + + def frob[F[_]](foo: Foo[F]) = + foo match { + case Bar() => () + } +} diff --git a/tests/pos/i618.scala b/tests/pos/i618.scala new file mode 100644 index 000000000..70be56cc2 --- /dev/null +++ b/tests/pos/i618.scala @@ -0,0 +1,3 @@ +class C(val f: Any*) + +class D(override val f: Nothing) extends C(f) diff --git a/tests/pos/overloaded.scala b/tests/pos/overloaded.scala index 56cfbccef..0ccc553a8 100644 --- a/tests/pos/overloaded.scala +++ b/tests/pos/overloaded.scala @@ -57,3 +57,30 @@ object overloaded { val a: A = fr(new C) val b: B = fr(new C) } + +// from #1381 + +object Foo { + class Bar[T] + implicit def const[T](x: T): Bar[T] = ??? + + def bar[T](e: T): Any = ??? + def bar[T](e: Bar[T]): Any = ??? + + val b: Bar[Int] = ??? + bar(b) +} + +object Test2 { + trait A; trait B + class C1 { + def f(x: A): Unit = println("A") + } + class C2 extends C1 { + def f(x: B): Unit = println("B") + } + object Test extends C2 with App { + implicit def a2b(x: A): B = new B {} + f(new A {}) + } +} -- cgit v1.2.3