diff --git a/compiler/test-resources/repl/i5345 b/compiler/test-resources/repl/i5345 new file mode 100644 index 000000000000..655258018144 --- /dev/null +++ b/compiler/test-resources/repl/i5345 @@ -0,0 +1,2 @@ +scala> def x[A, B]: ImplicitConverter[A, B] = _ => ??? +def x[A, B] => ImplicitConverter[A, B] diff --git a/compiler/test-resources/repl/i5733 b/compiler/test-resources/repl/i5733 new file mode 100644 index 000000000000..e9afea5e98ec --- /dev/null +++ b/compiler/test-resources/repl/i5733 @@ -0,0 +1,7 @@ +scala> abstract class F { def f(arg: Any): Unit; override def toString = "F" } +// defined class F +scala> val f: F = println +1 | val f: F = println + | ^^^^^^^ + |method println is eta-expanded even though F does not have the @FunctionalInterface annotation. +val f: F = F diff --git a/tests/neg/i2032.scala b/tests/neg/i2032.scala new file mode 100644 index 000000000000..e4325275383f --- /dev/null +++ b/tests/neg/i2032.scala @@ -0,0 +1,2 @@ +class foo(annotation: Any) +@foo(new AnyRef {}) trait A // error: found: foo, required: scala.annotation.Annotation diff --git a/tests/neg/i3506.scala b/tests/neg/i3506.scala new file mode 100644 index 000000000000..51f0da36a64c --- /dev/null +++ b/tests/neg/i3506.scala @@ -0,0 +1,2 @@ +trait C2[@specialized A] // error +class specialized extends C2[Char] // error diff --git a/tests/pos-java-interop/i2109/Annot.java b/tests/pos-java-interop/i2109/Annot.java new file mode 100644 index 000000000000..cf7cbe9c5718 --- /dev/null +++ b/tests/pos-java-interop/i2109/Annot.java @@ -0,0 +1,4 @@ +package foo; +import java.lang.annotation.*; + +public @interface Annot {} diff --git a/tests/pos-java-interop/i2109/Foo.scala b/tests/pos-java-interop/i2109/Foo.scala new file mode 100644 index 000000000000..29cda983de41 --- /dev/null +++ b/tests/pos-java-interop/i2109/Foo.scala @@ -0,0 +1,5 @@ +class Foo { + import foo.Annot + + @Annot def bla = () +} diff --git a/tests/pos/i2339.scala b/tests/pos/i2339.scala new file mode 100644 index 000000000000..25afa8254b64 --- /dev/null +++ b/tests/pos/i2339.scala @@ -0,0 +1,9 @@ +import scala.collection.mutable + +case class Foo[K, V]()(implicit conv: ImplicitConverter[V, Ordered[V]]) +extends mutable.HashMap[K,V] { + + val a = this.toSeq.sortWith { case ((_, v1), (_, v2)) => v1 > v2 } + + val b = this.toSeq.sortWith(_._2 > _._2) +} diff --git a/tests/pos/i4316.scala b/tests/pos/i4316.scala new file mode 100644 index 000000000000..2b1e9a854e29 --- /dev/null +++ b/tests/pos/i4316.scala @@ -0,0 +1,12 @@ +object Test { + + case class Bar[A] + + def meth[A](consumer: A => Unit, s: Bar[A]): Unit = { + s match { + case bar: Bar[a] => { + meth(consumer, new Bar[a]) // ok with `meth[a]` + } + } + } +} diff --git a/tests/run/i1533.scala b/tests/run/i1533.scala new file mode 100644 index 000000000000..48862e360eff --- /dev/null +++ b/tests/run/i1533.scala @@ -0,0 +1,7 @@ +object Test { + def main(args: Array[String]): Unit = { + val x = (if (1 == 1) 1 else 2.0): Any + assert(x.isInstanceOf[java.lang.Integer]) + assert(x == 1) + } +}