summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t7605-deprecation.check15
-rw-r--r--test/files/neg/t7605-deprecation.scala7
-rw-r--r--test/files/pos/SI-4012-a.scala7
-rw-r--r--test/files/pos/SI-4012-b.scala15
-rw-r--r--test/files/pos/t1014.scala16
-rw-r--r--test/files/pos/t1203a.scala13
-rw-r--r--test/files/pos/t2698.scala14
-rw-r--r--test/files/pos/t3160.scala6
-rw-r--r--test/files/pos/t6201.scala19
-rw-r--r--test/files/presentation/completion-implicit-chained.check29
-rw-r--r--test/files/presentation/completion-implicit-chained/Test.scala3
-rw-r--r--test/files/presentation/completion-implicit-chained/src/Completions.scala12
-rw-r--r--test/files/run/fors.check28
-rw-r--r--test/files/run/fors.scala84
-rw-r--r--test/files/run/mutable-anyrefmap.scala91
-rw-r--r--test/files/run/mutable-longmap.scala79
-rw-r--r--test/files/run/reflection-sync-subtypes.check0
-rw-r--r--test/files/run/reflection-sync-subtypes.scala (renamed from test/disabled/run/reflection-sync-subtypes.scala)0
-rw-r--r--test/files/run/repl-backticks.check2
-rw-r--r--test/files/run/repl-backticks.scala18
-rw-r--r--test/files/run/t1500.check3
-rw-r--r--test/files/run/t1500.scala46
-rw-r--r--test/files/run/t1501.check3
-rw-r--r--test/files/run/t1501.scala56
-rw-r--r--test/files/run/t4124.check4
-rw-r--r--test/files/run/t4124.scala24
-rw-r--r--test/files/run/t6546.flags1
-rw-r--r--test/files/run/t6546/A_1.scala6
-rw-r--r--test/files/run/t6546/B_2.scala8
29 files changed, 601 insertions, 8 deletions
diff --git a/test/files/neg/t7605-deprecation.check b/test/files/neg/t7605-deprecation.check
index 9c466c058c..6db94613a1 100644
--- a/test/files/neg/t7605-deprecation.check
+++ b/test/files/neg/t7605-deprecation.check
@@ -1,12 +1,15 @@
-t7605-deprecation.scala:2: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit =`.
- def this(i: Int) { this() }
- ^
-t7605-deprecation.scala:3: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit =`.
+t7605-deprecation.scala:2: warning: Procedure syntax is deprecated. Convert procedure `bar` to method by adding `: Unit =`.
def bar {}
^
-t7605-deprecation.scala:4: warning: Procedure syntax is deprecated. Convert procedure to method by adding `: Unit`.
+t7605-deprecation.scala:3: warning: Procedure syntax is deprecated. Convert procedure `baz` to method by adding `: Unit`.
def baz
^
+t7605-deprecation.scala:4: warning: Procedure syntax is deprecated. Convert procedure `boo` to method by adding `: Unit`.
+ def boo(i: Int, l: Long)
+ ^
+t7605-deprecation.scala:5: warning: Procedure syntax is deprecated. Convert procedure `boz` to method by adding `: Unit =`.
+ def boz(i: Int, l: Long) {}
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-three warnings found
+four warnings found
one error found
diff --git a/test/files/neg/t7605-deprecation.scala b/test/files/neg/t7605-deprecation.scala
index 4a7dcd26d6..2b3362f94a 100644
--- a/test/files/neg/t7605-deprecation.scala
+++ b/test/files/neg/t7605-deprecation.scala
@@ -1,5 +1,8 @@
abstract class Foo {
- def this(i: Int) { this() }
def bar {}
def baz
-} \ No newline at end of file
+ def boo(i: Int, l: Long)
+ def boz(i: Int, l: Long) {}
+ def this(i: Int) { this() } // Don't complain here!
+ def foz: Unit // Don't complain here!
+}
diff --git a/test/files/pos/SI-4012-a.scala b/test/files/pos/SI-4012-a.scala
new file mode 100644
index 0000000000..7fceeea3c3
--- /dev/null
+++ b/test/files/pos/SI-4012-a.scala
@@ -0,0 +1,7 @@
+trait C1[+A] {
+ def head: A = sys.error("")
+}
+trait C2[@specialized +A] extends C1[A] {
+ override def head: A = super.head
+}
+class C3 extends C2[Char]
diff --git a/test/files/pos/SI-4012-b.scala b/test/files/pos/SI-4012-b.scala
new file mode 100644
index 0000000000..6bc8592766
--- /dev/null
+++ b/test/files/pos/SI-4012-b.scala
@@ -0,0 +1,15 @@
+trait Super[@specialized(Int) A] {
+ def superb = 0
+}
+
+object Sub extends Super[Int] {
+ // it is expected that super[Super].superb crashes, since
+ // specialization does parent class rewiring, and the super
+ // of Sub becomes Super$mcII$sp and not Super. But I consider
+ // this normal behavior -- if you want, I can modify duplicatiors
+ // to make this work, but I consider it's best to keep this
+ // let the user know Super is not the superclass anymore.
+ // super[Super].superb - Vlad
+ super.superb // okay
+ override def superb: Int = super.superb // okay
+}
diff --git a/test/files/pos/t1014.scala b/test/files/pos/t1014.scala
new file mode 100644
index 0000000000..6fb7f7ba49
--- /dev/null
+++ b/test/files/pos/t1014.scala
@@ -0,0 +1,16 @@
+class NodeSeq
+class Elem extends NodeSeq
+
+class EO extends App with Moo {
+ // return type is Flog, inherited from overridden method.
+ // implicit conversions are applied because expected type `pt` is `Flog` when `computeType(rhs, pt)`.
+ def cat = (??? : Elem)
+
+ implicit def nodeSeqToFlog(in: Elem): Flog = new Flog(in)
+}
+
+trait Moo {
+ def cat: Flog
+}
+
+class Flog(val in: NodeSeq)
diff --git a/test/files/pos/t1203a.scala b/test/files/pos/t1203a.scala
new file mode 100644
index 0000000000..cf5ab9fba0
--- /dev/null
+++ b/test/files/pos/t1203a.scala
@@ -0,0 +1,13 @@
+class Node
+object NodeSeq {
+ implicit def seqToNodeSeq(s: Seq[Node]): NodeSeq = ???
+}
+abstract class NodeSeq extends collection.immutable.Seq[Node]
+
+case class ant(t: String) extends scala.annotation.Annotation
+object Test {
+ def main(args: Array[String]): Unit = {
+ val a: NodeSeq @ant("12") = Nil
+ println(a)
+ }
+}
diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala
new file mode 100644
index 0000000000..bce02e48b3
--- /dev/null
+++ b/test/files/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: _*)
+}
diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala
new file mode 100644
index 0000000000..cc007dc014
--- /dev/null
+++ b/test/files/pos/t3160.scala
@@ -0,0 +1,6 @@
+import scala.collection.mutable._
+class Node
+
+class A {
+ def f(x: Node): Node = ???
+}
diff --git a/test/files/pos/t6201.scala b/test/files/pos/t6201.scala
new file mode 100644
index 0000000000..d4e5bce03a
--- /dev/null
+++ b/test/files/pos/t6201.scala
@@ -0,0 +1,19 @@
+// probably needs xml's weirdness to reproduce
+// (specifically, _root_.scala.xml.Null being in the root package)
+class Elem
+
+class Test {
+ def elem: Elem = ???
+
+ class Foo1 {
+ def must(x: Elem) = ()
+ }
+
+ class Foo2 {
+ def must(x: Int) = ()
+ }
+ implicit def toFoo1(s: Elem) = new Foo1()
+ implicit def toFoo2(s: Elem) = new Foo2()
+
+ def is: Unit = { (elem) }
+} \ No newline at end of file
diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check
new file mode 100644
index 0000000000..b34e6bc7e1
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained.check
@@ -0,0 +1,29 @@
+reload: Completions.scala
+
+askTypeCompletion at Completions.scala(11,16)
+================================================================================
+[response] askCompletionAt (11,16)
+retrieved 24 members
+[inaccessible] protected[package lang] def clone(): Object
+[inaccessible] protected[package lang] def finalize(): Unit
+def equals(x$1: Any): Boolean
+def hashCode(): Int
+def map(x: Int => Int)(implicit a: DummyImplicit): test.O.type
+def toString(): String
+final def !=(x$1: Any): Boolean
+final def !=(x$1: AnyRef): Boolean
+final def ##(): Int
+final def ==(x$1: Any): Boolean
+final def ==(x$1: AnyRef): Boolean
+final def asInstanceOf[T0]: T0
+final def eq(x$1: AnyRef): Boolean
+final def isInstanceOf[T0]: Boolean
+final def ne(x$1: AnyRef): Boolean
+final def notify(): Unit
+final def notifyAll(): Unit
+final def synchronized[T0](x$1: T0): T0
+final def wait(): Unit
+final def wait(x$1: Long): Unit
+final def wait(x$1: Long,x$2: Int): Unit
+private[this] val prefix123: Int
+================================================================================
diff --git a/test/files/presentation/completion-implicit-chained/Test.scala b/test/files/presentation/completion-implicit-chained/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/completion-implicit-chained/src/Completions.scala b/test/files/presentation/completion-implicit-chained/src/Completions.scala
new file mode 100644
index 0000000000..67922dfec0
--- /dev/null
+++ b/test/files/presentation/completion-implicit-chained/src/Completions.scala
@@ -0,0 +1,12 @@
+package test
+
+import scala.Predef.DummyImplicit // turn off other predef implicits for a cleaner .check file.
+
+object O {
+ def map(x: Int => Int)(implicit a: DummyImplicit): O.type = this
+ val prefix123 : Int = 0
+}
+
+class Foo {
+ O.map(x => x)./*!*/ // we want the presentation compiler to apply the implicit argument list.
+}
diff --git a/test/files/run/fors.check b/test/files/run/fors.check
new file mode 100644
index 0000000000..b459f00b49
--- /dev/null
+++ b/test/files/run/fors.check
@@ -0,0 +1,28 @@
+
+testOld
+1 2 3
+2
+2
+3
+1 2 3
+1 2 3
+0 1 2 3 4 5 6 7 8 9
+0 2 4 6 8
+0 2 4 6 8
+a b c
+b c
+b c
+
+testNew
+3
+1 2 3
+1 2 3
+0 1 2 3 4 5 6 7 8 9
+0 2 4 6 8
+0 2 4 6 8
+0 2 4 6 8
+0 2 4 6 8
+0 2 4 6 8
+0 2 4 6 8
+0 2 4 6 8
+a b c
diff --git a/test/files/run/fors.scala b/test/files/run/fors.scala
new file mode 100644
index 0000000000..c778df3e24
--- /dev/null
+++ b/test/files/run/fors.scala
@@ -0,0 +1,84 @@
+//############################################################################
+// for-comprehensions (old and new syntax)
+//############################################################################
+
+//############################################################################
+
+object Test extends App {
+ val xs = List(1, 2, 3)
+ val ys = List('a, 'b, 'c)
+
+ def it = 0 until 10
+
+ val ar = "abc".toCharArray
+
+ /////////////////// old syntax ///////////////////
+
+ def testOld {
+ println("\ntestOld")
+
+ // lists
+ for (x <- xs) print(x + " "); println
+ for (x <- xs;
+ if x % 2 == 0) print(x + " "); println
+ for {x <- xs
+ if x % 2 == 0} print(x + " "); println
+ var n = 0
+ for (_ <- xs) n += 1; println(n)
+ for ((x, y) <- xs zip ys) print(x + " "); println
+ for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println
+
+ // iterators
+ for (x <- it) print(x + " "); println
+ for (x <- it;
+ if x % 2 == 0) print(x + " "); println
+ for {x <- it
+ if x % 2 == 0} print(x + " "); println
+
+ // arrays
+ for (x <- ar) print(x + " "); println
+ for (x <- ar;
+ if x.toInt > 97) print(x + " "); println
+ for {x <- ar
+ if x.toInt > 97} print(x + " "); println
+
+ }
+
+ /////////////////// new syntax ///////////////////
+
+ def testNew {
+ println("\ntestNew")
+
+ // lists
+ var n = 0
+ for (_ <- xs) n += 1; println(n)
+ for ((x, y) <- xs zip ys) print(x + " "); println
+ for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println
+
+ // iterators
+ for (x <- it) print(x + " "); println
+ for (x <- it if x % 2 == 0) print(x + " "); println
+ for (x <- it; if x % 2 == 0) print(x + " "); println
+ for (x <- it;
+ if x % 2 == 0) print(x + " "); println
+ for (x <- it
+ if x % 2 == 0) print(x + " "); println
+ for {x <- it
+ if x % 2 == 0} print(x + " "); println
+ for (x <- it;
+ y = 2
+ if x % y == 0) print(x + " "); println
+ for {x <- it
+ y = 2
+ if x % y == 0} print(x + " "); println
+
+ // arrays
+ for (x <- ar) print(x + " "); println
+
+ }
+
+ ////////////////////////////////////////////////////
+
+ testOld
+ testNew
+}
diff --git a/test/files/run/mutable-anyrefmap.scala b/test/files/run/mutable-anyrefmap.scala
new file mode 100644
index 0000000000..ff615d0daf
--- /dev/null
+++ b/test/files/run/mutable-anyrefmap.scala
@@ -0,0 +1,91 @@
+object Test extends App {
+
+ import scala.collection.mutable.HashMap;
+ import scala.collection.mutable.AnyRefMap;
+
+ val keys = Array(
+ null, "perch", "herring", "salmon", "pike", "cod", ""
+ )
+
+ val rn = new scala.util.Random(42L)
+ var arm = AnyRefMap.empty[String, Int]
+ val hm = HashMap.empty[String, Int]
+
+ def checkConsistent = hm.forall{ case (k,v) => arm.get(k).exists(_ == v) }
+
+ assert {
+ (0 to 10000).forall{ i =>
+ val k = keys(rn.nextInt(keys.length))
+ if (rn.nextInt(100) < 2) arm = arm.clone()
+ if (rn.nextInt(100) < 5) arm.repack()
+ if (rn.nextBoolean) {
+ hm += ((k, i))
+ rn.nextInt(6) match {
+ case 0 => arm += ((k, i))
+ case 1 => arm += (k, i)
+ case 2 => arm(k) = i
+ case 3 => arm.put(k,i)
+ case 4 => arm ++= List((k,i))
+ case _ => if (!arm.contains(k)) arm.getOrElseUpdate(k,i)
+ else arm += (k,i)
+ }
+ }
+ else {
+ hm -= k
+ rn.nextInt(2) match {
+ case 0 => arm -= k
+ case _ => arm --= List(k)
+ }
+ }
+ checkConsistent
+ }
+ }
+
+ assert {
+ val mapped =
+ arm.map{ case (k,v) => (if (k==null) "" else k+k) -> v.toString }
+ mapped.getClass == arm.getClass
+ }
+
+ assert {
+ val arm2 = new AnyRefMap[java.lang.Integer,Unit](2000000)
+ for (i <- 0 until 1000000) arm2(java.lang.Integer.valueOf(i)) = ()
+
+ arm2.size == 1000000 &&
+ (0 to 1100000 by 100000).map(java.lang.Integer.valueOf).forall(i => (arm2 contains i) == i < 1000000)
+ }
+
+ arm = AnyRefMap("heron" -> 22, "dove" -> 5, "budgie" -> 0)
+
+ assert{
+ var s = ""
+ arm.foreachKey(s += _)
+
+ s.length == "herondovebudgie".length &&
+ s.contains("heron") &&
+ s.contains("dove") &&
+ s.contains("budgie")
+ }
+
+ assert{ var s = 0L; arm.foreachValue(s += _); s == 27L }
+
+ assert {
+ val m2 = arm.mapValuesNow(_+2)
+ arm.transformValues(_+2)
+ m2 == arm && !(m2 eq arm) && (for ((_,v) <- arm) yield v).sum == 33L
+ }
+
+ assert {
+ val arm2 = new AnyRefMap[String, String](x => if (x==null) "null" else x)
+ arm2 += ("cod" -> "fish", "Rarity" -> "unicorn")
+ val hm2 = (new HashMap[String,String]) ++= arm2
+
+ List(null, "cod", "sparrow", "Rarity").forall(i =>
+ arm2.get(i) == hm2.get(i) &&
+ arm2.getOrElse(i, "") == hm2.getOrElse(i, "") &&
+ arm2(i) == hm2.get(i).getOrElse(if (i==null) "null" else i.toString) &&
+ arm2.getOrNull(i) == hm2.get(i).orNull
+ )
+ }
+}
+
diff --git a/test/files/run/mutable-longmap.scala b/test/files/run/mutable-longmap.scala
new file mode 100644
index 0000000000..07fd80f6f0
--- /dev/null
+++ b/test/files/run/mutable-longmap.scala
@@ -0,0 +1,79 @@
+object Test extends App {
+
+ import scala.collection.mutable.HashMap;
+ import scala.collection.mutable.LongMap;
+
+ val keys = Array(
+ Long.MinValue, Int.MinValue - 1L, Int.MinValue, -9127, -1,
+ 0, 1, 9127, Int.MaxValue, Long.MaxValue
+ )
+
+ val rn = new scala.util.Random(42L)
+ var lm = LongMap.empty[Long]
+ val hm = HashMap.empty[Long,Long]
+
+ def checkConsistent = hm.forall{ case (k,v) => lm.get(k).exists(_ == v) }
+
+ assert {
+ (0 to 10000).forall{ i =>
+ val k = keys(rn.nextInt(keys.length))
+ if (rn.nextInt(100) < 2) lm = lm.clone()
+ if (rn.nextInt(100) < 5) lm.repack()
+ if (rn.nextBoolean) {
+ hm += ((k, i))
+ rn.nextInt(6) match {
+ case 0 => lm += ((k, i))
+ case 1 => lm += (k, i)
+ case 2 => lm(k) = i
+ case 3 => lm.put(k,i)
+ case 4 => lm ++= List((k,i))
+ case _ => if (!lm.contains(k)) lm.getOrElseUpdate(k,i)
+ else lm += (k,i)
+ }
+ }
+ else {
+ hm -= k
+ rn.nextInt(2) match {
+ case 0 => lm -= k
+ case _ => lm --= List(k)
+ }
+ }
+ checkConsistent
+ }
+ }
+
+ assert {
+ lm.map{ case (k,v) => -k*k -> v.toString }.getClass == lm.getClass
+ }
+
+ assert {
+ val lm2 = new LongMap[Unit](2000000)
+ for (i <- 0 until 1000000) lm2(i) = ()
+
+ lm2.size == 1000000 &&
+ (0 to 1100000 by 100000).forall(i => (lm2 contains i) == i < 1000000)
+ }
+
+ lm = LongMap(8L -> 22L, -5L -> 5L, Long.MinValue -> 0L)
+
+ assert{ var s = 0L; lm.foreachKey(s += _); s == Long.MinValue + 3 }
+ assert{ var s = 0L; lm.foreachValue(s += _); s == 27L }
+ assert {
+ val m2 = lm.mapValuesNow(_+2)
+ lm.transformValues(_+2)
+ m2 == lm && !(m2 eq lm) && (for ((_,v) <- lm) yield v).sum == 33L
+ }
+
+ assert {
+ val lm2 = new LongMap[String](_.toString)
+ lm2 += (5L -> "fish", 0L -> "unicorn")
+ val hm2 = (new HashMap[Long,String]) ++= lm2
+
+ List(Long.MinValue, 0L, 1L, 5L).forall(i =>
+ lm2.get(i) == hm2.get(i) &&
+ lm2.getOrElse(i, "") == hm2.getOrElse(i, "") &&
+ lm2(i) == hm2.get(i).getOrElse(i.toString) &&
+ lm2.getOrNull(i) == hm2.get(i).orNull
+ )
+ }
+}
diff --git a/test/files/run/reflection-sync-subtypes.check b/test/files/run/reflection-sync-subtypes.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/reflection-sync-subtypes.check
diff --git a/test/disabled/run/reflection-sync-subtypes.scala b/test/files/run/reflection-sync-subtypes.scala
index 7f75a464ac..7f75a464ac 100644
--- a/test/disabled/run/reflection-sync-subtypes.scala
+++ b/test/files/run/reflection-sync-subtypes.scala
diff --git a/test/files/run/repl-backticks.check b/test/files/run/repl-backticks.check
new file mode 100644
index 0000000000..c0561abd7c
--- /dev/null
+++ b/test/files/run/repl-backticks.check
@@ -0,0 +1,2 @@
+import java.lang.Thread.`yield`
+import scala.`package`.Throwable
diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala
new file mode 100644
index 0000000000..e40a8bc662
--- /dev/null
+++ b/test/files/run/repl-backticks.scala
@@ -0,0 +1,18 @@
+import scala.tools.nsc._
+
+object Test {
+ val testCode = """
+ import java.lang.Thread.`yield`
+ import scala.`package`.Throwable
+
+ `yield`
+ """
+
+ def main(args: Array[String]) {
+ val settings = new Settings()
+ settings.classpath.value = System.getProperty("java.class.path")
+ val repl = new interpreter.IMain(settings)
+ repl.interpret(testCode)
+ }
+}
+
diff --git a/test/files/run/t1500.check b/test/files/run/t1500.check
new file mode 100644
index 0000000000..94a169333b
--- /dev/null
+++ b/test/files/run/t1500.check
@@ -0,0 +1,3 @@
+defined class posingAs
+resolve: [A, B](x: A @posingAs[B])B
+x: Any = 7
diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala
new file mode 100644
index 0000000000..30c026f70f
--- /dev/null
+++ b/test/files/run/t1500.scala
@@ -0,0 +1,46 @@
+import scala.tools.nsc._
+
+object Test {
+
+ /**
+ * Type inference overlooks constraints posed by type parameters in annotations on types.
+ */
+
+ val testCode = """
+
+ class posingAs[A] extends annotation.TypeConstraint
+
+ def resolve[A,B](x: A @posingAs[B]): B = x.asInstanceOf[B]
+
+ val x = resolve(7: @posingAs[Any])
+
+ """
+
+ def main(args: Array[String]) {
+
+ val settings = new Settings()
+ settings.classpath.value = System.getProperty("java.class.path")
+ val tool = new interpreter.IMain(settings)
+ val global = tool.global
+
+ import global._
+ import definitions._
+
+ object checker extends AnnotationChecker {
+
+ /** Check annotations to decide whether tpe1 <:< tpe2 */
+ def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
+
+ tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
+
+ }
+ }
+
+ global.addAnnotationChecker(checker)
+
+ tool.interpret(testCode)
+
+ }
+
+}
+
diff --git a/test/files/run/t1501.check b/test/files/run/t1501.check
new file mode 100644
index 0000000000..f0fa9112a5
--- /dev/null
+++ b/test/files/run/t1501.check
@@ -0,0 +1,3 @@
+defined class xyz
+loopWhile: [T](cond: => Boolean)(body: => Unit @xyz[T])Unit @xyz[T]
+test: ()Unit @xyz[Int]
diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala
new file mode 100644
index 0000000000..ca6bf357fb
--- /dev/null
+++ b/test/files/run/t1501.scala
@@ -0,0 +1,56 @@
+import scala.tools.nsc._
+
+object Test {
+
+ /**
+ * ...
+ */
+
+ val testCode = """
+
+ class xyz[A] extends annotation.TypeConstraint
+
+ def loopWhile[T](cond: =>Boolean)(body: =>(Unit @xyz[T])): Unit @ xyz[T] = {{
+ if (cond) {{
+ body
+ loopWhile[T](cond)(body)
+ }}
+ }}
+
+ def test() = {{
+ var x = 7
+ loopWhile(x != 0) {{
+ x = x - 1
+ (): @xyz[Int]
+ }}
+ }}
+
+ """
+
+ def main(args: Array[String]) {
+ val settings = new Settings()
+ settings.classpath.value = System.getProperty("java.class.path")
+ val tool = new interpreter.IMain(settings)
+ val global = tool.global
+
+ import global._
+ import definitions._
+
+ object checker extends AnnotationChecker {
+
+ /** Check annotations to decide whether tpe1 <:< tpe2 */
+ def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
+
+ tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
+
+ }
+ }
+
+ global.addAnnotationChecker(checker)
+
+ tool.interpret(testCode)
+
+ }
+
+}
+
diff --git a/test/files/run/t4124.check b/test/files/run/t4124.check
new file mode 100644
index 0000000000..66a0092d93
--- /dev/null
+++ b/test/files/run/t4124.check
@@ -0,0 +1,4 @@
+hi
+hi
+bye
+bye
diff --git a/test/files/run/t4124.scala b/test/files/run/t4124.scala
new file mode 100644
index 0000000000..9f35b57ce3
--- /dev/null
+++ b/test/files/run/t4124.scala
@@ -0,0 +1,24 @@
+import xml.Node
+
+object Test extends App {
+ val body: Node = <elem>hi</elem>
+ println ((body: AnyRef, "foo") match {
+ case (node: Node, "bar") => "bye"
+ case (ser: Serializable, "foo") => "hi"
+ })
+
+ println ((body, "foo") match {
+ case (node: Node, "bar") => "bye"
+ case (ser: Serializable, "foo") => "hi"
+ })
+
+ println ((body: AnyRef, "foo") match {
+ case (node: Node, "foo") => "bye"
+ case (ser: Serializable, "foo") => "hi"
+ })
+
+ println ((body: AnyRef, "foo") match {
+ case (node: Node, "foo") => "bye"
+ case (ser: Serializable, "foo") => "hi"
+ })
+}
diff --git a/test/files/run/t6546.flags b/test/files/run/t6546.flags
new file mode 100644
index 0000000000..eb4d19bcb9
--- /dev/null
+++ b/test/files/run/t6546.flags
@@ -0,0 +1 @@
+-optimise \ No newline at end of file
diff --git a/test/files/run/t6546/A_1.scala b/test/files/run/t6546/A_1.scala
new file mode 100644
index 0000000000..bd086c08f8
--- /dev/null
+++ b/test/files/run/t6546/A_1.scala
@@ -0,0 +1,6 @@
+final class Opt {
+ @inline def getOrElse(x: => String): String = ""
+}
+class A_1 {
+ def f(x: Opt): String = x getOrElse null
+}
diff --git a/test/files/run/t6546/B_2.scala b/test/files/run/t6546/B_2.scala
new file mode 100644
index 0000000000..64ec966f75
--- /dev/null
+++ b/test/files/run/t6546/B_2.scala
@@ -0,0 +1,8 @@
+import scala.tools.partest.BytecodeTest
+
+object Test extends BytecodeTest {
+ def show: Unit = {
+ val node = loadClassNode("A_1")
+ assert(node.innerClasses.isEmpty, node.innerClasses)
+ }
+}