diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-15 15:14:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-15 15:14:46 +0200 |
commit | 91f067143c9564a052058fa02c73ae6cde3020e6 (patch) | |
tree | fc4cb290d0045cd9b45a599c3c3f9ab0b4ae985d | |
parent | 12ba8af12b7157f7f8c4ff6e106f4b30b0bd472a (diff) | |
download | dotty-91f067143c9564a052058fa02c73ae6cde3020e6.tar.gz dotty-91f067143c9564a052058fa02c73ae6cde3020e6.tar.bz2 dotty-91f067143c9564a052058fa02c73ae6cde3020e6.zip |
Add tests
Adds the original test form #1381. t2660 looks similar.
Also adds some unrelated tests I had in the queue that now
compile.
-rw-r--r-- | tests/pos/hkgadt.scala | 9 | ||||
-rw-r--r-- | tests/pos/i618.scala | 3 | ||||
-rw-r--r-- | tests/pos/overloaded.scala | 27 |
3 files changed, 39 insertions, 0 deletions
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 {}) + } +} |