aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/pending/pos/t2613.scala11
-rw-r--r--tests/pending/pos/t2693.scala6
-rw-r--r--tests/pos/t2610.scala17
-rw-r--r--tests/pos/t2619.scala80
-rw-r--r--tests/pos/t262.scala14
-rw-r--r--tests/pos/t2624.scala4
-rwxr-xr-xtests/pos/t2635.scala16
-rw-r--r--tests/pos/t2660.scala (renamed from tests/new/t2660.scala)0
-rw-r--r--tests/pos/t2664.scala9
-rw-r--r--tests/pos/t2665.scala3
-rw-r--r--tests/pos/t2667.scala6
-rw-r--r--tests/pos/t2669.scala28
-rw-r--r--tests/pos/t267.scala55
-rwxr-xr-xtests/pos/t2683.scala7
-rw-r--r--tests/pos/t2691.scala16
-rw-r--r--tests/pos/t2698.scala14
16 files changed, 286 insertions, 0 deletions
diff --git a/tests/pending/pos/t2613.scala b/tests/pending/pos/t2613.scala
new file mode 100644
index 000000000..c234d4c0d
--- /dev/null
+++ b/tests/pending/pos/t2613.scala
@@ -0,0 +1,11 @@
+import language.existentials
+
+object Test {
+ class Row
+
+ abstract class MyRelation [R <: Row, +Relation <: MyRelation[R, Relation]]
+
+ type M = MyRelation[_ <: Row, _ <: MyRelation]
+
+ val (x,y): (String, M) = null
+}
diff --git a/tests/pending/pos/t2693.scala b/tests/pending/pos/t2693.scala
new file mode 100644
index 000000000..5d4d0380c
--- /dev/null
+++ b/tests/pending/pos/t2693.scala
@@ -0,0 +1,6 @@
+class A {
+ trait T[A]
+ def usetHk[T[_], A](ta: T[A]) = 0
+ usetHk(new T[Int]{}: T[Int])
+ usetHk(new T[Int]{}) // fails with: found: java.lang.Object with T[Int], required: ?T[ ?A ]
+}
diff --git a/tests/pos/t2610.scala b/tests/pos/t2610.scala
new file mode 100644
index 000000000..8a82b4a72
--- /dev/null
+++ b/tests/pos/t2610.scala
@@ -0,0 +1,17 @@
+package mada; package defects; package tests
+
+package object bbb {
+ def bar = ()
+ aaa.foo // value foo is not a member of package mada.defects.tests.aaa
+}
+
+package object aaa {
+ def foo = ()
+}
+
+/* compiles successfully if placed here..
+package object bbb {
+ def bar = ()
+ aaa.foo // value foo is not a member of package mada.defects.tests.aaa
+}
+*/
diff --git a/tests/pos/t2619.scala b/tests/pos/t2619.scala
new file mode 100644
index 000000000..283d93bf2
--- /dev/null
+++ b/tests/pos/t2619.scala
@@ -0,0 +1,80 @@
+abstract class F {
+ final def apply(x: Int): AnyRef = null
+}
+abstract class AbstractModule {
+ def as: List[AnyRef]
+ def ms: List[AbstractModule]
+ def fs: List[F] = Nil
+ def rs(x: Int): List[AnyRef] = fs.map(_(x))
+}
+abstract class ModuleType1 extends AbstractModule {}
+abstract class ModuleType2 extends AbstractModule {}
+
+object ModuleAE extends ModuleType1 {
+ def as = Nil
+ def ms = Nil
+}
+object ModuleAF extends ModuleType2 {
+ def as = Nil
+ def ms = List(ModuleAE)
+}
+object ModuleAG extends ModuleType1 {
+ def as = List("")
+ def ms = Nil
+}
+object ModuleAI extends ModuleType1 {
+ def as = Nil
+ def ms = List(ModuleAE)
+}
+object ModuleAK extends ModuleType2 {
+ def as = Nil
+ def ms = List(ModuleAF)
+}
+object ModuleAL extends ModuleType1 {
+ def as = Nil
+ def ms = List(
+ ModuleAG,
+ ModuleAI
+ )
+}
+object ModuleAM extends ModuleType1 {
+ def as = Nil
+ def ms = List(
+ ModuleAL,
+ ModuleAE
+ ) ::: List(ModuleAK)
+}
+object ModuleBE extends ModuleType1 {
+ def as = Nil
+ def ms = Nil
+}
+object ModuleBF extends ModuleType2 {
+ def as = Nil
+ def ms = List(ModuleBE)
+}
+object ModuleBG extends ModuleType1 {
+ def as = List("")
+ def ms = Nil
+}
+object ModuleBI extends ModuleType1 {
+ def as = Nil
+ def ms = List(ModuleBE)
+}
+object ModuleBK extends ModuleType2 {
+ def as = Nil
+ def ms = List(ModuleBF)
+}
+object ModuleBL extends ModuleType1 {
+ def as = Nil
+ def ms = List(
+ ModuleBG,
+ ModuleBI
+ )
+}
+object ModuleBM extends ModuleType1 {
+ def as = Nil
+ def ms = List(
+ ModuleBL,
+ ModuleBE
+ ) ::: List(ModuleBK)
+}
diff --git a/tests/pos/t262.scala b/tests/pos/t262.scala
new file mode 100644
index 000000000..ec6187b36
--- /dev/null
+++ b/tests/pos/t262.scala
@@ -0,0 +1,14 @@
+object O {
+ abstract class A {
+ def f:A;
+ }
+ class B extends A {
+ def f = if(1 == 2) new C else new D;
+ }
+ class C extends A {
+ def f = this;
+ }
+ class D extends A {
+ def f = this;
+ }
+}
diff --git a/tests/pos/t2624.scala b/tests/pos/t2624.scala
new file mode 100644
index 000000000..76f0e3036
--- /dev/null
+++ b/tests/pos/t2624.scala
@@ -0,0 +1,4 @@
+object Test {
+ List(1).map(identity(_))
+ List(1).map(identity) // this didn't typecheck before the fix
+}
diff --git a/tests/pos/t2635.scala b/tests/pos/t2635.scala
new file mode 100755
index 000000000..7cd553135
--- /dev/null
+++ b/tests/pos/t2635.scala
@@ -0,0 +1,16 @@
+abstract class Base
+
+object Test
+{
+ def run(c: Class[_ <: Base]): Unit = {
+ }
+
+ def main(args: Array[String]): Unit =
+ {
+ val sc: Option[Class[_ <: Base]] = Some(classOf[Base])
+ sc match {
+ case Some(c) => run(c)
+ case None =>
+ }
+ }
+}
diff --git a/tests/new/t2660.scala b/tests/pos/t2660.scala
index 94a40f740..94a40f740 100644
--- a/tests/new/t2660.scala
+++ b/tests/pos/t2660.scala
diff --git a/tests/pos/t2664.scala b/tests/pos/t2664.scala
new file mode 100644
index 000000000..7b667d010
--- /dev/null
+++ b/tests/pos/t2664.scala
@@ -0,0 +1,9 @@
+package pkg1 {
+ class C {
+ private[pkg1] def foo: Int = 1
+ }
+
+ trait T extends C {
+ private[pkg1] abstract override def foo = super.foo + 1
+ }
+}
diff --git a/tests/pos/t2665.scala b/tests/pos/t2665.scala
new file mode 100644
index 000000000..e46453534
--- /dev/null
+++ b/tests/pos/t2665.scala
@@ -0,0 +1,3 @@
+object Test {
+ val x: Unit = Array("")
+}
diff --git a/tests/pos/t2667.scala b/tests/pos/t2667.scala
new file mode 100644
index 000000000..7f1f36f00
--- /dev/null
+++ b/tests/pos/t2667.scala
@@ -0,0 +1,6 @@
+object A {
+ def foo(x: Int, y: Int*): Int = 45
+ def foo[T](x: T*): Int = 55
+
+ val x: Unit = foo(23, 23f)
+}
diff --git a/tests/pos/t2669.scala b/tests/pos/t2669.scala
new file mode 100644
index 000000000..72e931178
--- /dev/null
+++ b/tests/pos/t2669.scala
@@ -0,0 +1,28 @@
+// #2629, #2639, #2669
+object Test2669 {
+
+ def test[T](l: java.util.ArrayList[_ <: T]) = 1
+ test(new java.util.ArrayList[String]())
+
+}
+
+import java.util.ArrayList
+
+object Test2629 {
+ def main(args: Array[String]): Unit = {
+ val l = new ArrayList[String](1)
+ val m = new ArrayList(l)
+
+ println(l.size)
+ println(m.size)
+ }
+}
+
+
+import java.util.Vector
+
+// scalac cannot detect lack of type params, but then throws AssertionError later:
+class TVector2639 {
+ val b = new Vector // this line passed without error detected
+ val a = new Vector(1) // this line caused throwing AssertionError when scalac
+}
diff --git a/tests/pos/t267.scala b/tests/pos/t267.scala
new file mode 100644
index 000000000..7e5876eae
--- /dev/null
+++ b/tests/pos/t267.scala
@@ -0,0 +1,55 @@
+package expAbstractData
+
+/** A base class consisting of
+ * - a root trait (i.e. abstract class) `Exp' with an `eval' function
+ * - an abstract type `exp' bounded by `Exp'
+ * - a concrete instance class `Num' of `Exp' for numeric literals
+ */
+trait Base {
+ type exp <: Exp
+
+ trait Exp {
+ def eval: Int
+ }
+ class Num(v: Int) extends Exp { self: exp =>
+ val value = v
+ def eval = value
+ }
+}
+
+object testBase extends App with Base {
+ type exp = Exp
+ val term = new Num(2);
+ Console.println(term.eval)
+}
+
+/** Data extension: An extension of `Base' with `Plus' expressions
+ */
+trait BasePlus extends Base {
+ class Plus(l: exp, r: exp) extends Exp { self: exp =>
+ val left = l
+ val right = r
+ def eval = left.eval + right.eval
+ }
+}
+
+/** Operation extension: An extension of `Base' with 'show' methods.
+ */
+trait Show extends Base {
+ type exp <: Exp1
+
+ trait Exp1 extends Exp {
+ def show: String
+ }
+ class Num1(v: Int) extends Num(v) with Exp1 { self: exp with Num1 =>
+ def show = value.toString()
+ }
+}
+
+/** Operation extension: An extension of `BasePlus' with 'show' methods.
+ */
+trait ShowPlus extends BasePlus with Show {
+ class Plus1(l: exp, r: exp) extends Plus(l, r) with Exp1 { self: exp with Plus1 =>
+ def show = left.show + " + " + right.show
+ }
+}
diff --git a/tests/pos/t2683.scala b/tests/pos/t2683.scala
new file mode 100755
index 000000000..4ba34b554
--- /dev/null
+++ b/tests/pos/t2683.scala
@@ -0,0 +1,7 @@
+class A
+class B extends A
+
+object Test {
+ val c: Class[_ <: A] = Class.forName("B").asSubclass(classOf[A])
+ val x: Option[Class[_ <: A]] = Some(3).map { case _ => c }
+}
diff --git a/tests/pos/t2691.scala b/tests/pos/t2691.scala
new file mode 100644
index 000000000..5f0ddd122
--- /dev/null
+++ b/tests/pos/t2691.scala
@@ -0,0 +1,16 @@
+object Breakdown {
+ def unapplySeq(x: Int): Some[List[String]] = Some(List("", "there"))
+}
+object Test {
+ 42 match {
+ case Breakdown("") => // needed to trigger bug
+ case Breakdown("", who) => println ("hello " + who)
+ }
+}
+object Test2 {
+ 42 match {
+ case Breakdown("") => // needed to trigger bug
+ case Breakdown("foo") => // needed to trigger bug
+ case Breakdown("", who) => println ("hello " + who)
+ }
+}
diff --git a/tests/pos/t2698.scala b/tests/pos/t2698.scala
new file mode 100644
index 000000000..bce02e48b
--- /dev/null
+++ b/tests/pos/t2698.scala
@@ -0,0 +1,14 @@
+class WordExp {
+ abstract class Label
+ type _labelT <: Label
+}
+
+import scala.collection._
+
+abstract class S2 {
+ val lang: WordExp
+ type __labelT = lang._labelT
+
+ var deltaq: Array[__labelT] = _
+ def delta1 = immutable.Map(deltaq.zipWithIndex: _*)
+}