aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-15 17:46:39 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-19 14:47:16 +0100
commit4619393a6c3b52127ceec07e2fc3630d22aef51a (patch)
treec7bfcee91ca38b06e1aa81da7770001e3e5c5da9 /tests/pos
parent8e257a63872697bd48a51ce93a0289c9f5acdfd8 (diff)
downloaddotty-4619393a6c3b52127ceec07e2fc3630d22aef51a.tar.gz
dotty-4619393a6c3b52127ceec07e2fc3630d22aef51a.tar.bz2
dotty-4619393a6c3b52127ceec07e2fc3630d22aef51a.zip
Categorize more tests
All pos tests up to 3999 have been triaged. One new test in pending.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/t3048.scala8
-rw-r--r--tests/pos/t3071.scala7
-rw-r--r--tests/pos/t3079.scala17
-rw-r--r--tests/pos/t3136.scala19
-rw-r--r--tests/pos/t3160.scala6
-rw-r--r--tests/pos/t3174b.scala12
-rw-r--r--tests/pos/t318.scala9
-rw-r--r--tests/pos/t3272.scala8
-rw-r--r--tests/pos/t3312.scala17
-rw-r--r--tests/pos/t3371.scala9
-rw-r--r--tests/pos/t3373.scala11
-rw-r--r--tests/pos/t3374.scala6
-rw-r--r--tests/pos/t3384.scala14
-rw-r--r--tests/pos/t3420.scala5
-rw-r--r--tests/pos/t3430.scala13
-rw-r--r--tests/pos/t3440.scala18
-rw-r--r--tests/pos/t3452f.scala10
-rw-r--r--tests/pos/t348plus.scala24
-rw-r--r--tests/pos/t3495.scala2
-rw-r--r--tests/pos/t3528.scala8
-rw-r--r--tests/pos/t3560.scala2
-rw-r--r--tests/pos/t3570.scala7
-rw-r--r--tests/pos/t3578.scala30
-rw-r--r--tests/pos/t3582.scala12
-rw-r--r--tests/pos/t359.scala28
-rw-r--r--tests/pos/t361.scala16
-rw-r--r--tests/pos/t3636.scala49
-rw-r--r--tests/pos/t3670.scala43
-rw-r--r--tests/pos/t3671.scala7
-rw-r--r--tests/pos/t3672.scala4
-rw-r--r--tests/pos/t3676.scala5
-rw-r--r--tests/pos/t372.scala2
-rw-r--r--tests/pos/t3731.scala13
-rw-r--r--tests/pos/t374.scala21
-rw-r--r--tests/pos/t3774.scala5
-rw-r--r--tests/pos/t3792.scala4
-rw-r--r--tests/pos/t3808.scala11
-rw-r--r--tests/pos/t3833.scala26
-rw-r--r--tests/pos/t3836.scala14
-rw-r--r--tests/pos/t3837.scala10
-rw-r--r--tests/pos/t3861.scala2
-rw-r--r--tests/pos/t3866.scala17
-rw-r--r--tests/pos/t3883.scala15
-rw-r--r--tests/pos/t389.scala7
-rw-r--r--tests/pos/t3890.scala4
-rw-r--r--tests/pos/t3898.scala6
-rw-r--r--tests/pos/t3924.scala6
-rw-r--r--tests/pos/t3927.scala6
-rw-r--r--tests/pos/t397.scala16
-rw-r--r--tests/pos/t3972.scala11
50 files changed, 622 insertions, 0 deletions
diff --git a/tests/pos/t3048.scala b/tests/pos/t3048.scala
new file mode 100644
index 000000000..dc056ecba
--- /dev/null
+++ b/tests/pos/t3048.scala
@@ -0,0 +1,8 @@
+class B
+object C extends B
+
+class F[T <: B](cons: => T)
+class F2[T <: B](cons: => T) extends F(cons)
+
+object D extends F2(C) // works
+object E extends F2(new B {})
diff --git a/tests/pos/t3071.scala b/tests/pos/t3071.scala
new file mode 100644
index 000000000..7e1443294
--- /dev/null
+++ b/tests/pos/t3071.scala
@@ -0,0 +1,7 @@
+class A (val i: Int) {
+ def copy (i: Int = this.i): A = new A(i)
+}
+
+class B (val j: Int) extends A(1) {
+ override def copy (j: Int = this.j): B = new B(j)
+}
diff --git a/tests/pos/t3079.scala b/tests/pos/t3079.scala
new file mode 100644
index 000000000..b7bd63190
--- /dev/null
+++ b/tests/pos/t3079.scala
@@ -0,0 +1,17 @@
+sealed trait Identity[A] {
+ val value: A
+}
+
+trait Coerce[A, B] {
+ def unwrap: (A => B)
+}
+
+object Coerce {
+ def IdentityCoerce[B] = new Coerce[Identity[B], B] {
+ // java.lang.Error: A in trait Identity cannot be instantiated from ?x$1.type
+ def unwrap = _.value
+
+ // Providing the type of _ works around the problem.
+ //def unwrap = (_: Identity[B]).value
+ }
+}
diff --git a/tests/pos/t3136.scala b/tests/pos/t3136.scala
new file mode 100644
index 000000000..239bd8f54
--- /dev/null
+++ b/tests/pos/t3136.scala
@@ -0,0 +1,19 @@
+class Type
+class Symbol
+case class PolyType(tps: List[Symbol], res: Type) extends Type
+class OtherType extends Type
+
+// case class NullaryMethodType(tp: Type) extends Type
+
+object NullaryMethodType {
+ def apply(resTpe: Type): Type = PolyType(List(), resTpe)
+ def unapply(tp: Type): Option[(Type)] = None
+}
+
+object Test {
+ def TEST(tp: Type): String =
+ tp match {
+ case PolyType(ps1, PolyType(ps2, res @ PolyType(a, b))) => "1" + tp // couldn't find a simpler version that still crashes
+ case NullaryMethodType(meh) => "2" + meh
+ }
+}
diff --git a/tests/pos/t3160.scala b/tests/pos/t3160.scala
new file mode 100644
index 000000000..cc007dc01
--- /dev/null
+++ b/tests/pos/t3160.scala
@@ -0,0 +1,6 @@
+import scala.collection.mutable._
+class Node
+
+class A {
+ def f(x: Node): Node = ???
+}
diff --git a/tests/pos/t3174b.scala b/tests/pos/t3174b.scala
new file mode 100644
index 000000000..4df1bfe83
--- /dev/null
+++ b/tests/pos/t3174b.scala
@@ -0,0 +1,12 @@
+trait Foo[X] { def foo : Map[String,Foo[X]] }
+
+object Test {
+ def f[T]() : Foo[T] = {
+ class Anon extends Foo[T] {
+ var foo: Map[String, Foo[T]] = Map[String,Foo[T]]()
+ //def foo = Map[String,Foo[T]]()
+ //def foo_=(x: Map[String,Foo[T]]) {}
+ }
+ new Anon
+ }
+}
diff --git a/tests/pos/t318.scala b/tests/pos/t318.scala
new file mode 100644
index 000000000..dbe0e0528
--- /dev/null
+++ b/tests/pos/t318.scala
@@ -0,0 +1,9 @@
+object Test {
+ def fun: Int = {
+ object o {
+ def a: Int = 1;
+ class C { def b: Int = a; }
+ }
+ 0
+ }
+}
diff --git a/tests/pos/t3272.scala b/tests/pos/t3272.scala
new file mode 100644
index 000000000..cf54d6a84
--- /dev/null
+++ b/tests/pos/t3272.scala
@@ -0,0 +1,8 @@
+trait A {
+ trait C[+T] {
+ protected[this] def f(t: T): Unit = {}
+ }
+ trait D[T] extends C[T] {
+ def g(t: T): Unit = { f(t) }
+ }
+}
diff --git a/tests/pos/t3312.scala b/tests/pos/t3312.scala
new file mode 100644
index 000000000..aef965d2e
--- /dev/null
+++ b/tests/pos/t3312.scala
@@ -0,0 +1,17 @@
+trait Root {
+ def say: String
+}
+
+trait A extends Root {
+ override def say: String = "bow"
+}
+
+trait B extends Root {
+ override def say: String = "hi"
+}
+
+object Foo extends A with B {
+ override def say: String = foo(super[A].say)
+
+ def foo(p: => String): String = p
+}
diff --git a/tests/pos/t3371.scala b/tests/pos/t3371.scala
new file mode 100644
index 000000000..897cd9de4
--- /dev/null
+++ b/tests/pos/t3371.scala
@@ -0,0 +1,9 @@
+// that compiles
+class Test(myValue:String) { println(myValue) }
+
+// that compiles too
+trait Other { val otherValue = "" }
+class Test2(myValue:String) { self:Other => println(otherValue) }
+
+// that does not compile saying that myValue is not found
+class Test3(myValue:String) { self:Other => println(myValue) }
diff --git a/tests/pos/t3373.scala b/tests/pos/t3373.scala
new file mode 100644
index 000000000..b6594fb6c
--- /dev/null
+++ b/tests/pos/t3373.scala
@@ -0,0 +1,11 @@
+class Entry(time: Long) {
+ def getTime: Long = time
+}
+
+object Test {
+ def extractTime(e: Entry) = e.getTime
+
+ implicit val orderEntries: Ordering[Entry] = new Ordering[Entry] {
+ def compare(first: Entry, second: Entry) = extractTime(first) compare extractTime(second)
+ }
+}
diff --git a/tests/pos/t3374.scala b/tests/pos/t3374.scala
new file mode 100644
index 000000000..c9bedcf69
--- /dev/null
+++ b/tests/pos/t3374.scala
@@ -0,0 +1,6 @@
+trait Parent {
+ type Test[A, H[B <: A]]
+}
+trait Sub extends Parent {
+ type Test[AS, HS[B <: AS]] = AS
+}
diff --git a/tests/pos/t3384.scala b/tests/pos/t3384.scala
new file mode 100644
index 000000000..4d4a81d69
--- /dev/null
+++ b/tests/pos/t3384.scala
@@ -0,0 +1,14 @@
+package test
+
+package p {
+ class A(a: String = "")
+}
+
+package object po {
+ type A = p.A
+}
+
+import po._
+class C {
+ val a = new A() //p.A.init$default$1)
+}
diff --git a/tests/pos/t3420.scala b/tests/pos/t3420.scala
new file mode 100644
index 000000000..0fc56ed67
--- /dev/null
+++ b/tests/pos/t3420.scala
@@ -0,0 +1,5 @@
+class C {
+ val cv = Map[Int, Int](1 -> 2)
+ lazy val cl = Map[Int, Int](1 -> 2)
+ def cd = Map[Int, Int](1 -> 2)
+}
diff --git a/tests/pos/t3430.scala b/tests/pos/t3430.scala
new file mode 100644
index 000000000..f86d776bd
--- /dev/null
+++ b/tests/pos/t3430.scala
@@ -0,0 +1,13 @@
+// package com.example
+
+object A {
+ def f1(f: String => Boolean) = f("a")
+
+ def f2(): Boolean =
+ f1 { s1 =>
+ f1 { s2 =>
+ while (true) { }
+ true
+ }
+ }
+}
diff --git a/tests/pos/t3440.scala b/tests/pos/t3440.scala
new file mode 100644
index 000000000..0e7ca6b70
--- /dev/null
+++ b/tests/pos/t3440.scala
@@ -0,0 +1,18 @@
+object test {
+ abstract class SampleFormat1 {
+ def readerFactory: Any
+ }
+
+ case object Int8 extends SampleFormat1 {
+ def readerFactory = sys.error("")
+ }
+ case object Int16 extends SampleFormat1 {
+ def readerFactory = sys.error("")
+ }
+
+ (new {}: Any) match {
+ case 8 => Int8
+ case 16 => Int16
+ case _ => sys.error("")
+ }
+}
diff --git a/tests/pos/t3452f.scala b/tests/pos/t3452f.scala
new file mode 100644
index 000000000..efe25a62f
--- /dev/null
+++ b/tests/pos/t3452f.scala
@@ -0,0 +1,10 @@
+class Base[Coll] {
+ trait Transformed[S] {
+ lazy val underlying: Coll = ???
+ }
+}
+
+class Derived extends Base[String] {
+ class C extends Transformed[Any]
+}
+
diff --git a/tests/pos/t348plus.scala b/tests/pos/t348plus.scala
new file mode 100644
index 000000000..e61f7346f
--- /dev/null
+++ b/tests/pos/t348plus.scala
@@ -0,0 +1,24 @@
+// bug #348
+
+trait Foo {
+ type bar <: Bar;
+ abstract class Bar;
+ case class Baz(r:bar) extends Bar;
+ case object NoBar extends Bar;
+}
+object Test extends App {
+ object ConcreteFooBar extends Foo { // if moved to toplevel, it works
+ type bar = Bar;
+ }
+ def foo = {
+ import ConcreteFooBar._ ;
+ Baz( NoBar )
+ }
+}
+
+// bug #367
+
+object Bla {
+ def foo(): Unit = (return null).equals(null);
+}
+
diff --git a/tests/pos/t3495.scala b/tests/pos/t3495.scala
new file mode 100644
index 000000000..8d5dff430
--- /dev/null
+++ b/tests/pos/t3495.scala
@@ -0,0 +1,2 @@
+class Foo { }
+
diff --git a/tests/pos/t3528.scala b/tests/pos/t3528.scala
new file mode 100644
index 000000000..ff49b3e92
--- /dev/null
+++ b/tests/pos/t3528.scala
@@ -0,0 +1,8 @@
+class A {
+ // 3528 - not fixed
+ // def f1 = List(List(1), Stream(1))
+ // 3528 comments
+ def f2 = List(Set(1,2,3), List(1,2,3))
+ // 2322
+ def f3 = List(null: Range, null: List[Int])
+}
diff --git a/tests/pos/t3560.scala b/tests/pos/t3560.scala
new file mode 100644
index 000000000..3cde9710d
--- /dev/null
+++ b/tests/pos/t3560.scala
@@ -0,0 +1,2 @@
+trait Foo[X] { def foo : Map[String,Foo[X]] }
+object T3560 { def f[T]() : Foo[T] = new Foo[T] { var foo = Map[String,Foo[T]]() } }
diff --git a/tests/pos/t3570.scala b/tests/pos/t3570.scala
new file mode 100644
index 000000000..237391719
--- /dev/null
+++ b/tests/pos/t3570.scala
@@ -0,0 +1,7 @@
+class test {
+ object Break extends Throwable
+ def break = throw Break
+ def block(x: => Unit): Unit = {
+ try { x } catch { case e: Break.type => }
+ }
+}
diff --git a/tests/pos/t3578.scala b/tests/pos/t3578.scala
new file mode 100644
index 000000000..2ce92a776
--- /dev/null
+++ b/tests/pos/t3578.scala
@@ -0,0 +1,30 @@
+object Test {
+ sealed abstract class JValue {
+ def ++(other: JValue) = {
+ def append(value1: JValue, value2: JValue): JValue = (value1, value2) match {
+ case (JNothing, x) => x
+ case (x, JNothing) => x
+ case (JObject(xs), x: JField) => JObject(xs ::: List(x))
+ case (x: JField, JObject(xs)) => JObject(x :: xs)
+ case (JArray(xs), JArray(ys)) => JArray(xs ::: ys)
+ case (JArray(xs), v: JValue) => JArray(xs ::: List(v))
+ case (v: JValue, JArray(xs)) => JArray(v :: xs)
+ case (f1: JField, f2: JField) => JObject(f1 :: f2 :: Nil)
+ case (JField(n, v1), v2: JValue) => JField(n, append(v1, v2))
+ case (x, y) => JArray(x :: y :: Nil)
+ }
+ append(this, other)
+ }
+ }
+
+ case object JNothing extends JValue
+ case object JNull extends JValue
+ case class JString(s: String) extends JValue
+ case class JDouble(num: Double) extends JValue
+ case class JInt(num: BigInt) extends JValue
+ case class JBool(value: Boolean) extends JValue
+ case class JField(name: String, value: JValue) extends JValue
+ case class JObject(obj: List[JField]) extends JValue
+ case class JArray(arr: List[JValue]) extends JValue
+}
+
diff --git a/tests/pos/t3582.scala b/tests/pos/t3582.scala
new file mode 100644
index 000000000..d13d69775
--- /dev/null
+++ b/tests/pos/t3582.scala
@@ -0,0 +1,12 @@
+trait C[A]
+object Test {
+ def ImplicitParamCA[CC[A], A](implicit ev: C[A]): Unit = {implicitly[C[A]]} // must use this exact syntax...
+ // error: could not find implicit value for parameter e: C[A]
+}
+// [[syntax trees at end of typer]]
+// abstract trait C#5[A#9116 >: Nothing#5832 <: Any#52] extends scala#33.AnyRef#2780;
+// final object Test#15 extends java.lang.Object#2485 with ScalaObject#1913 {
+// def ImplicitParamCA#9123[CC#9124[A#10858 >: Nothing#5832 <: Any#52] >: [A#10858]Nothing#5832 <: [A#10858]Any#52,
+// A#9125 >: Nothing#5832 <: Any#52](implicit ev#10856: C#5[A#9127]): Unit#3818
+// = scala#34.this.Predef#1683.implicitly#8816[C#5[A#10858]]()
+// }
diff --git a/tests/pos/t359.scala b/tests/pos/t359.scala
new file mode 100644
index 000000000..11233c3ba
--- /dev/null
+++ b/tests/pos/t359.scala
@@ -0,0 +1,28 @@
+object Bug359 {
+ class C;
+ def f1(xs: List[C]): C = {
+ g {
+ xs =>
+ if (false) {
+ f1(xs)
+ } else {
+ val a: C = null;
+ val b: C = null;
+ if (xs.isEmpty) a else b
+ }
+ }
+ }
+ def f2(xs: List[C]): C = {
+ g {
+ xs =>
+ if (false) {
+ val a: C = null;
+ val b: C = null;
+ if (xs.isEmpty) a else b
+ } else {
+ f2(xs);
+ }
+ }
+ }
+ private def g(op: List[C] => C): C = null;
+}
diff --git a/tests/pos/t361.scala b/tests/pos/t361.scala
new file mode 100644
index 000000000..1d19ecb52
--- /dev/null
+++ b/tests/pos/t361.scala
@@ -0,0 +1,16 @@
+class Bug361Global extends Bug361Trees
+
+abstract class Bug361Trees { self: Bug361Global =>
+
+ abstract class Tree {
+ var pos: Int = 0
+ }
+
+ object posAssigner {
+ def atPos[T <: Tree](pos: Int, tree: T): T = {
+ tree.pos = pos; tree
+ }
+ }
+
+ def atPos[T <: Tree](pos: Int)(tree: T): T = posAssigner.atPos(pos, tree)
+}
diff --git a/tests/pos/t3636.scala b/tests/pos/t3636.scala
new file mode 100644
index 000000000..cd224a32f
--- /dev/null
+++ b/tests/pos/t3636.scala
@@ -0,0 +1,49 @@
+class CTxnLocal[ T ] {
+ def set( x: T )( implicit t: Txn ): Unit = {}
+ def get( implicit t: Txn ) : T = null.asInstanceOf[ T ]
+ def initialValue( t: Txn ) : T = null.asInstanceOf[ T ]
+}
+
+trait Txn
+
+trait ProcTxn {
+ def ccstm: Txn
+}
+
+trait TxnLocal[ @specialized T ] {
+ def apply()( implicit tx: ProcTxn ) : T
+ def set( v: T )( implicit tx: ProcTxn ) : Unit
+ def swap( v: T )( implicit tx: ProcTxn ) : T
+ def transform( f: T => T )( implicit tx: ProcTxn ) : Unit
+}
+
+object TxnLocal {
+ def apply[ @specialized T ] : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ])
+ def apply[ @specialized T ]( initValue: => T ) : TxnLocal[ T ] = new Impl( new CTxnLocal[ T ] {
+ override def initialValue( tx: Txn ): T = initValue
+ })
+
+ private class Impl[ T ]( c: CTxnLocal[ T ]) extends TxnLocal[ T ] {
+ def apply()( implicit tx: ProcTxn ) : T = c.get( tx.ccstm )
+ def set( v: T )( implicit tx: ProcTxn ) : Unit = c.set( v )( tx.ccstm )
+ def swap( v: T )( implicit tx: ProcTxn ) : T = {
+ // currently not implemented in CTxnLocal
+ val oldV = apply
+ set( v )
+ oldV
+ }
+ def transform( f: T => T )( implicit tx: ProcTxn ): Unit = {
+ set( f( apply ))
+ }
+ }
+}
+
+
+object Transition {
+ private val currentRef = TxnLocal[ Transition ]( Instant )
+ def current( implicit tx: ProcTxn ) : Transition = currentRef()
+}
+
+sealed abstract class Transition
+case object Instant extends Transition
+
diff --git a/tests/pos/t3670.scala b/tests/pos/t3670.scala
new file mode 100644
index 000000000..4eb7cebbc
--- /dev/null
+++ b/tests/pos/t3670.scala
@@ -0,0 +1,43 @@
+class A {
+ val n = {
+ val z = {
+ lazy val bb = 1
+ bb
+ }
+ val a = {
+ lazy val cc = 2
+ cc
+ }
+ lazy val b = {
+ lazy val dd = 3
+ dd
+ }
+ z
+ }
+}
+
+class B {
+ locally {
+ lazy val ms = "as"
+ ms
+ }
+}
+
+class C {
+ val things = List("things")
+ if (things.size < 100) {
+ lazy val msg = "foo"
+ msg
+ }
+}
+
+class D {
+ val things = List("things")
+ if (things.size < 100) {
+ if (things.size > 10) {
+ lazy val msg = "foo"
+ msg
+ }
+ }
+}
+
diff --git a/tests/pos/t3671.scala b/tests/pos/t3671.scala
new file mode 100644
index 000000000..afb3a539d
--- /dev/null
+++ b/tests/pos/t3671.scala
@@ -0,0 +1,7 @@
+object Crash {
+ def crash(value: Int): Unit =
+ value match {
+ case java.lang.Integer.MAX_VALUE => println("MAX_VALUE")
+ case java.lang.Integer.MIN_VALUE => println("MIN_VALUE")
+ }
+}
diff --git a/tests/pos/t3672.scala b/tests/pos/t3672.scala
new file mode 100644
index 000000000..b2752ce21
--- /dev/null
+++ b/tests/pos/t3672.scala
@@ -0,0 +1,4 @@
+object Test {
+ def foo(f: Int => Int) = () ; foo { implicit x : Int => x + 1 }
+ def bar(f: Int => Int) = () ; foo { x : Int => x + 1 }
+}
diff --git a/tests/pos/t3676.scala b/tests/pos/t3676.scala
new file mode 100644
index 000000000..60c0ceaec
--- /dev/null
+++ b/tests/pos/t3676.scala
@@ -0,0 +1,5 @@
+trait SeqLike[+Repr]
+trait Seq extends SeqLike[Seq]
+
+trait MySeq extends Seq with SeqLike[MySub]
+trait MySub extends MySeq
diff --git a/tests/pos/t372.scala b/tests/pos/t372.scala
new file mode 100644
index 000000000..9ce5b9ab7
--- /dev/null
+++ b/tests/pos/t372.scala
@@ -0,0 +1,2 @@
+class Bug372Names;
+class Bug372Symbols { self: Bug372Symbols with Bug372Names => }
diff --git a/tests/pos/t3731.scala b/tests/pos/t3731.scala
new file mode 100644
index 000000000..7a3cbec0f
--- /dev/null
+++ b/tests/pos/t3731.scala
@@ -0,0 +1,13 @@
+object Test{
+ trait ZW[S]{type T}
+ def ZipWith[S, M <: ZW[S]]: M#T = sys.error("ZW")
+
+ // meh must be parameterised to force an asSeenFrom that
+ // duplicates the refinement in the TR's pre without updating its sym
+ def meh[A] = ZipWith[A, ZW[A]{type T=Stream[A]}]
+
+ meh[Int]: Stream[Int]
+}
+// debugging output in coevolveSym should say:
+// coevolved type T#11029 : Stream#3234[A#9228] to type T#11277 : Stream#3234[A#9227]
+// with Test.ZW#9219[A#9228]{type T#11029 = Stream#3234[A#9228]} -> Test.ZW#9219[A#9227]{type T#11277 = Stream#3234[A#9227]}
diff --git a/tests/pos/t374.scala b/tests/pos/t374.scala
new file mode 100644
index 000000000..fb9c0b402
--- /dev/null
+++ b/tests/pos/t374.scala
@@ -0,0 +1,21 @@
+object tokens extends Enumeration {
+ type Token = Value;
+ val BAD = Value("<bad>");
+ val IDENT = Value("ident");
+ val NAME = Value("name");
+}
+
+object test extends AnyRef with App {
+ import tokens._;
+
+ val reserved = new scala.collection.mutable.HashMap[String, Token]();
+
+ if (true) {
+ reserved.get("a") match {
+ case None => IDENT
+ case Some(tk) => tk
+ }
+ }
+ else
+ BAD
+}
diff --git a/tests/pos/t3774.scala b/tests/pos/t3774.scala
new file mode 100644
index 000000000..2869925b0
--- /dev/null
+++ b/tests/pos/t3774.scala
@@ -0,0 +1,5 @@
+// This used to hang the lub process. Now it rejects the file. This is still not correct,
+// but we can solve this only after a redesign of lub a la dot.
+object Hang {
+ Map[(Int,Int),List[Int]]() ++ (for(x <- 0 to 1 ; y <- 0 to 1) yield {(x,y)-> (0 to 1)})
+}
diff --git a/tests/pos/t3792.scala b/tests/pos/t3792.scala
new file mode 100644
index 000000000..364d46317
--- /dev/null
+++ b/tests/pos/t3792.scala
@@ -0,0 +1,4 @@
+object Test {
+ type Hui = Nil.type
+ val n: Hui = Nil
+}
diff --git a/tests/pos/t3808.scala b/tests/pos/t3808.scala
new file mode 100644
index 000000000..ec95fed4d
--- /dev/null
+++ b/tests/pos/t3808.scala
@@ -0,0 +1,11 @@
+object Test {
+ def meh: Unit = {
+ trait TC[I]
+ implicit val tci: TC[Int] = new TC[Int]{}
+
+ def baz[J : TC] : String = "meh"
+
+ baz
+ // () // commenting or uncommenting this line should not affect compilation (visibly)
+ }
+}
diff --git a/tests/pos/t3833.scala b/tests/pos/t3833.scala
new file mode 100644
index 000000000..2df658df1
--- /dev/null
+++ b/tests/pos/t3833.scala
@@ -0,0 +1,26 @@
+object Main {
+ def mkArray[T <: A](atype: Int) :T#AType = {
+ (atype match {
+ case 1 =>
+ new Array[Int](10)
+ // Decompiled code: return (Object[])new int[10];
+ case 2 =>
+ new Array[Float](10)
+ }).asInstanceOf[T#AType]
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(mkArray[I](1))
+ //java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
+ }
+}
+
+trait A {
+ type AType <: AnyRef
+}
+trait I extends A {
+ type AType = Array[Int]
+}
+trait F extends A {
+ type AType = Array[Float]
+}
diff --git a/tests/pos/t3836.scala b/tests/pos/t3836.scala
new file mode 100644
index 000000000..840f17116
--- /dev/null
+++ b/tests/pos/t3836.scala
@@ -0,0 +1,14 @@
+package foo
+
+package object bar {
+ type IOException = java.io.IOException
+}
+
+package baz {
+ import java.io._
+ import foo.bar._
+
+ object Test {
+ def f = new IOException
+ }
+}
diff --git a/tests/pos/t3837.scala b/tests/pos/t3837.scala
new file mode 100644
index 000000000..bcaf63cc8
--- /dev/null
+++ b/tests/pos/t3837.scala
@@ -0,0 +1,10 @@
+class BipClass { }
+trait BipTrait {
+ self: BipClass =>
+
+ private[this] def foo() = 5
+ def bar() = this.foo()
+}
+// error: value foo is not a member of BipTrait with BipClass
+// def bar() = this.foo()
+// ^
diff --git a/tests/pos/t3861.scala b/tests/pos/t3861.scala
new file mode 100644
index 000000000..5ebe02520
--- /dev/null
+++ b/tests/pos/t3861.scala
@@ -0,0 +1,2 @@
+trait Y
+abstract class X(x: Int) { self: Y => x }
diff --git a/tests/pos/t3866.scala b/tests/pos/t3866.scala
new file mode 100644
index 000000000..f1f64edb9
--- /dev/null
+++ b/tests/pos/t3866.scala
@@ -0,0 +1,17 @@
+abstract class ImplicitRepeated {
+ trait T[+A, +B]
+ trait X
+
+ def f[N, R <: List[_]](elems: T[N, R]*): Unit // alternative a)
+ def f[N, R <: List[_]](props: String, elems: T[N, R]*): Unit // alternative b)
+
+ // the following implicit causes "cannot be applied" errors
+ implicit def xToRight(r: X): T[Nothing, X] = null
+ implicit def anyToN[N](x: N): T[N, Nothing] = null
+
+
+ f("A", 1, 2) // should be implicitly resolved to alternative b)
+ f( 1, 2 ) // should be implicitly resolved to alternative a)
+ // ImplicitRepeated.this.f[Int, Nothing]("A", ImplicitRepeated.this.anyToN[Int](1), ImplicitRepeated.this.anyToN[Int](2));
+ // ImplicitRepeated.this.f[Int, Nothing](ImplicitRepeated.this.anyToN[Int](1), ImplicitRepeated.this.anyToN[Int](2))
+}
diff --git a/tests/pos/t3883.scala b/tests/pos/t3883.scala
new file mode 100644
index 000000000..1b62c0c6d
--- /dev/null
+++ b/tests/pos/t3883.scala
@@ -0,0 +1,15 @@
+// need to test both orders
+object A1 {
+ implicit def i: Equiv[Boolean] = sys.error("")
+ implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = sys.error("")
+
+ implicitly[Equiv[Boolean]]
+}
+
+object A2 {
+ implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = sys.error("")
+ implicit def i: Equiv[Boolean] = sys.error("")
+
+ implicitly[Equiv[Boolean]]
+}
+
diff --git a/tests/pos/t389.scala b/tests/pos/t389.scala
new file mode 100644
index 000000000..535bd4de8
--- /dev/null
+++ b/tests/pos/t389.scala
@@ -0,0 +1,7 @@
+object Test {
+ def a = 'a
+ def b = 'B
+ def c = '+
+ //def d = '`\n` //error: unclosed character literal
+ def e = '\u0041
+}
diff --git a/tests/pos/t3890.scala b/tests/pos/t3890.scala
new file mode 100644
index 000000000..0c5f5dfe6
--- /dev/null
+++ b/tests/pos/t3890.scala
@@ -0,0 +1,4 @@
+object Test {
+ def g[S, T <: S](s: S)(t: T): Unit = println("")
+ g("a")("a") // error: inferred type arguments [java.lang.String] do not conform to method g's type parameter bounds [T <: S]
+}
diff --git a/tests/pos/t3898.scala b/tests/pos/t3898.scala
new file mode 100644
index 000000000..ab47bbd87
--- /dev/null
+++ b/tests/pos/t3898.scala
@@ -0,0 +1,6 @@
+trait Atomic[@specialized(Boolean) T] {
+ def x: T
+
+ def f(fn: T => T): Boolean = f(fn(x), true)
+ def f[R](a: T, b: R): R = b
+}
diff --git a/tests/pos/t3924.scala b/tests/pos/t3924.scala
new file mode 100644
index 000000000..b11b67c56
--- /dev/null
+++ b/tests/pos/t3924.scala
@@ -0,0 +1,6 @@
+object Test {
+ class Hoe extends Serializable {
+ def add(a: java.io.Serializable): Unit = println(a)
+ def someMethod(): Unit = { add(this) }
+ }
+}
diff --git a/tests/pos/t3927.scala b/tests/pos/t3927.scala
new file mode 100644
index 000000000..5e0d581d4
--- /dev/null
+++ b/tests/pos/t3927.scala
@@ -0,0 +1,6 @@
+object A {
+ def x: Unit = {
+ implicit lazy val e: Equiv[Int] = sys.error("")
+ implicitly[Equiv[Int]]
+ }
+}
diff --git a/tests/pos/t397.scala b/tests/pos/t397.scala
new file mode 100644
index 000000000..87be2987a
--- /dev/null
+++ b/tests/pos/t397.scala
@@ -0,0 +1,16 @@
+abstract class Root {
+
+ abstract class Edge {
+ type V;
+ def source: V;
+ }
+
+ abstract class Graph {
+ type W;
+ type E <: Edge{type V = W};
+ def edge: E;
+ }
+
+ val g: Graph{type W = Int};
+ val x: Int = g.edge.source;
+}
diff --git a/tests/pos/t3972.scala b/tests/pos/t3972.scala
new file mode 100644
index 000000000..65ef43f84
--- /dev/null
+++ b/tests/pos/t3972.scala
@@ -0,0 +1,11 @@
+object CompilerCrash {
+ def main(args: Array[String]): Unit = {
+ args match {
+ case Array("a", a : _*) => { } // The code compiles fine if this line is commented out or "@ _*" is deleted or this line is swapped for the next line
+ case Array("b") => { } // The code compiles fine if this line is commented out
+ case Array("c", c) => {
+ 0 // The code compiles fine if this line is commented out
+ }
+ }
+ }
+}