Skip to content

Commit 818fdbc

Browse files
Merge pull request #5800 from dotty-staging/more-tests-2
Add regression tests for various open issues
2 parents 30b6a02 + ff5855d commit 818fdbc

File tree

9 files changed

+50
-0
lines changed

9 files changed

+50
-0
lines changed

compiler/test-resources/repl/i5345

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scala> def x[A, B]: ImplicitConverter[A, B] = _ => ???
2+
def x[A, B] => ImplicitConverter[A, B]

compiler/test-resources/repl/i5733

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
scala> abstract class F { def f(arg: Any): Unit; override def toString = "F" }
2+
// defined class F
3+
scala> val f: F = println
4+
1 | val f: F = println
5+
| ^^^^^^^
6+
|method println is eta-expanded even though F does not have the @FunctionalInterface annotation.
7+
val f: F = F

tests/neg/i2032.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class foo(annotation: Any)
2+
@foo(new AnyRef {}) trait A // error: found: foo, required: scala.annotation.Annotation

tests/neg/i3506.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
trait C2[@specialized A] // error
2+
class specialized extends C2[Char] // error
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package foo;
2+
import java.lang.annotation.*;
3+
4+
public @interface Annot {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Foo {
2+
import foo.Annot
3+
4+
@Annot def bla = ()
5+
}

tests/pos/i2339.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import scala.collection.mutable
2+
3+
case class Foo[K, V]()(implicit conv: ImplicitConverter[V, Ordered[V]])
4+
extends mutable.HashMap[K,V] {
5+
6+
val a = this.toSeq.sortWith { case ((_, v1), (_, v2)) => v1 > v2 }
7+
8+
val b = this.toSeq.sortWith(_._2 > _._2)
9+
}

tests/pos/i4316.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object Test {
2+
3+
case class Bar[A]
4+
5+
def meth[A](consumer: A => Unit, s: Bar[A]): Unit = {
6+
s match {
7+
case bar: Bar[a] => {
8+
meth(consumer, new Bar[a]) // ok with `meth[a]`
9+
}
10+
}
11+
}
12+
}

tests/run/i1533.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
val x = (if (1 == 1) 1 else 2.0): Any
4+
assert(x.isInstanceOf[java.lang.Integer])
5+
assert(x == 1)
6+
}
7+
}

0 commit comments

Comments
 (0)