diff options
Diffstat (limited to 'test/pending')
46 files changed, 468 insertions, 327 deletions
diff --git a/test/pending/buildmanager/t2443/BitSet.scala b/test/pending/buildmanager/t2443/BitSet.scala new file mode 100644 index 0000000000..8d7c8dcd23 --- /dev/null +++ b/test/pending/buildmanager/t2443/BitSet.scala @@ -0,0 +1,2 @@ +import scala.collection.BitSet +//class BitSet diff --git a/test/pending/buildmanager/t2443/t2443.changes/BitSet2.scala b/test/pending/buildmanager/t2443/t2443.changes/BitSet2.scala new file mode 100644 index 0000000000..27a5d4de9f --- /dev/null +++ b/test/pending/buildmanager/t2443/t2443.changes/BitSet2.scala @@ -0,0 +1 @@ +import scala.collection.BitSet diff --git a/test/pending/buildmanager/t2443/t2443.check b/test/pending/buildmanager/t2443/t2443.check new file mode 100644 index 0000000000..dd88e1ceb9 --- /dev/null +++ b/test/pending/buildmanager/t2443/t2443.check @@ -0,0 +1,6 @@ +builder > BitSet.scala +compiling Set(BitSet.scala) +builder > BitSet.scala +Changes: Map(class BitSet -> List(Removed(Class(BitSet)))) + + diff --git a/test/pending/buildmanager/t2443/t2443.test b/test/pending/buildmanager/t2443/t2443.test new file mode 100644 index 0000000000..a1d61ff5a3 --- /dev/null +++ b/test/pending/buildmanager/t2443/t2443.test @@ -0,0 +1,3 @@ +>>compile BitSet.scala +>>update BitSet.scala=>BitSet2.scala +>>compile BitSet.scala diff --git a/test/pending/continuations-run/example0.scala b/test/pending/continuations-run/example0.scala new file mode 100644 index 0000000000..44b1331339 --- /dev/null +++ b/test/pending/continuations-run/example0.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test0.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example1.scala b/test/pending/continuations-run/example1.scala new file mode 100644 index 0000000000..195a98e59f --- /dev/null +++ b/test/pending/continuations-run/example1.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test1.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example16.scala b/test/pending/continuations-run/example16.scala new file mode 100644 index 0000000000..5eb64046ed --- /dev/null +++ b/test/pending/continuations-run/example16.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test16Printf.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example2.scala b/test/pending/continuations-run/example2.scala new file mode 100644 index 0000000000..0d96257c40 --- /dev/null +++ b/test/pending/continuations-run/example2.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test2.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example3.scala b/test/pending/continuations-run/example3.scala new file mode 100644 index 0000000000..3f5052a4ad --- /dev/null +++ b/test/pending/continuations-run/example3.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test3.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example4.scala b/test/pending/continuations-run/example4.scala new file mode 100644 index 0000000000..66c6774791 --- /dev/null +++ b/test/pending/continuations-run/example4.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test4.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example5.scala b/test/pending/continuations-run/example5.scala new file mode 100644 index 0000000000..0994bdee8a --- /dev/null +++ b/test/pending/continuations-run/example5.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test5.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example6.scala b/test/pending/continuations-run/example6.scala new file mode 100644 index 0000000000..5207e3fc68 --- /dev/null +++ b/test/pending/continuations-run/example6.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test6.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example7.scala b/test/pending/continuations-run/example7.scala new file mode 100644 index 0000000000..fb22387dac --- /dev/null +++ b/test/pending/continuations-run/example7.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test7.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example8.scala b/test/pending/continuations-run/example8.scala new file mode 100644 index 0000000000..8e21e6c674 --- /dev/null +++ b/test/pending/continuations-run/example8.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test8.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/example9.scala b/test/pending/continuations-run/example9.scala new file mode 100644 index 0000000000..0f27c686f7 --- /dev/null +++ b/test/pending/continuations-run/example9.scala @@ -0,0 +1,9 @@ +// $Id$ + +object Test { + + def main(args: Array[String]): Any = { + examples.continuations.Test9Monads.main(args) + } + +}
\ No newline at end of file diff --git a/test/pending/continuations-run/foreach.check b/test/pending/continuations-run/foreach.check new file mode 100644 index 0000000000..9bab7a2eed --- /dev/null +++ b/test/pending/continuations-run/foreach.check @@ -0,0 +1,4 @@ +1 +2 +3 +enough is enough
\ No newline at end of file diff --git a/test/pending/continuations-run/foreach.scala b/test/pending/continuations-run/foreach.scala new file mode 100644 index 0000000000..4daade452c --- /dev/null +++ b/test/pending/continuations-run/foreach.scala @@ -0,0 +1,33 @@ +// $Id$ + +import scala.util.continuations._ + +import scala.util.continuations.Loops._ + +object Test { + + def main(args: Array[String]): Any = { + + + reset { + + val list = List(1,2,3,4,5) + + for (x <- list.suspendable) { + + shift { k: (Unit => Unit) => + println(x) + if (x < 3) + k() + else + println("enough is enough") + } + + } + + } + + + } + +}
\ No newline at end of file diff --git a/test/pending/jvm/actor-executor4.check b/test/pending/jvm/actor-executor4.check new file mode 100644 index 0000000000..da78f45836 --- /dev/null +++ b/test/pending/jvm/actor-executor4.check @@ -0,0 +1,21 @@ +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +Two: OK +One: OK +One exited diff --git a/test/pending/jvm/actor-executor4.scala b/test/pending/jvm/actor-executor4.scala new file mode 100644 index 0000000000..a912d76094 --- /dev/null +++ b/test/pending/jvm/actor-executor4.scala @@ -0,0 +1,64 @@ +import scala.actors.{Actor, Exit} +import scala.actors.scheduler.ExecutorScheduler +import java.util.concurrent.Executors + +object One extends AdaptedActor { + def act() { + Two.start() + var i = 0 + loopWhile (i < Test.NUM_MSG) { + i += 1 + Two ! 'MsgForTwo + react { + case 'MsgForOne => + if (i % (Test.NUM_MSG/10) == 0) + println("One: OK") + } + } + } +} + +object Two extends AdaptedActor { + def act() { + var i = 0 + loopWhile (i < Test.NUM_MSG) { + i += 1 + react { + case 'MsgForTwo => + if (i % (Test.NUM_MSG/10) == 0) + println("Two: OK") + One ! 'MsgForOne + } + } + } +} + +trait AdaptedActor extends Actor { + override def scheduler = + Test.scheduler +} + +object Test { + val NUM_MSG = 100000 + + val scheduler = + ExecutorScheduler( + Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()), + false) + + def main(args: Array[String]) { + (new AdaptedActor { + def act() { + trapExit = true + link(One) + One.start() + + receive { + case Exit(from, reason) => + println("One exited") + Test.scheduler.shutdown() + } + } + }).start() + } +} diff --git a/test/pending/jvm/t1464.check b/test/pending/jvm/t1464.check deleted file mode 100644 index c508d5366f..0000000000 --- a/test/pending/jvm/t1464.check +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/test/pending/neg/bug1210.check b/test/pending/neg/bug1210.check new file mode 100644 index 0000000000..4db920556f --- /dev/null +++ b/test/pending/neg/bug1210.check @@ -0,0 +1,7 @@ +bug1210.scala:13: error: illegal cyclic reference involving type Settings + val v: List[selfType] = f[selfType]((x: selfType) => x.v) + ^ +bug1210.scala:24: error: illegal cyclic reference involving type Settings + f[selfType](_.g) + ^ +two errors found diff --git a/test/pending/pos/t0644.scala b/test/pending/pos/t0644.scala deleted file mode 100644 index 5ad12c3632..0000000000 --- a/test/pending/pos/t0644.scala +++ /dev/null @@ -1,11 +0,0 @@ -class A { - def appply(): Int = 0 - def update(n: Int) {} -} - -class B extends A { - this() - this()=1 - super() - super()=1 -} diff --git a/test/pending/pos/t0816.scala b/test/pending/pos/t0816.scala deleted file mode 100644 index 44282ea872..0000000000 --- a/test/pending/pos/t0816.scala +++ /dev/null @@ -1,12 +0,0 @@ -abstract class Atest(val data: String) - -case class Btest(override val data: String, val b: boolean) extends Atest(data) - -case class Ctest(override val data: String) extends Btest(data, true) - -class testCaseClass { - def test(x: Atest) = x match { - case Ctest(data) => Console.println("C") - case Btest(data, b) => Console.println("B") - } -} diff --git a/test/pending/pos/t1035.scala b/test/pending/pos/t1035.scala deleted file mode 100644 index a280a415d2..0000000000 --- a/test/pending/pos/t1035.scala +++ /dev/null @@ -1,32 +0,0 @@ -//A fatal error or Scala compiler -// Scala compiler version 2.7.1-final -- (c) 2002-2010 LAMP/EPFL -// Carlos Loria cloria@artinsoft.com -// 7/10/2008 - -class A { - var name:String = _ - def getName() = name - def this(name:String, age:Int){this();this.name=name} - -} - -class B(name:String) extends A(name,0){ -} - -class D { - - object A { - def unapply(p:A) = Some(p.getName) - } - - object B { - def unapply(p:B) = Some(p.getName) - } - def foo(p:Any) = p match { - case B(n) => println("B") - case A(n) => println("A") - - - } - -} diff --git a/test/pending/pos/t1053.scala b/test/pending/pos/t1053.scala deleted file mode 100644 index 1d4dfb637e..0000000000 --- a/test/pending/pos/t1053.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait T[A] { trait U { type W = A; val x = 3 } } - -object Test { - val x : ({ type V = T[this.type] })#V = null - val y = new x.U { } -} diff --git a/test/pending/pos/t1380/gnujaxp.jar.desired.sha1 b/test/pending/pos/t1380/gnujaxp.jar.desired.sha1 new file mode 100644 index 0000000000..c155c2aaa2 --- /dev/null +++ b/test/pending/pos/t1380/gnujaxp.jar.desired.sha1 @@ -0,0 +1 @@ +ee000286d00c5209d5644462c1cfea87fc8b1342 ?gnujaxp.jar diff --git a/test/pending/pos/t1380/hallo.scala b/test/pending/pos/t1380/hallo.scala new file mode 100644 index 0000000000..27ecd9fb8b --- /dev/null +++ b/test/pending/pos/t1380/hallo.scala @@ -0,0 +1,3 @@ +object hallo { + def main(args:Array[String]) = println("hallo") +} diff --git a/test/pending/pos/t1659.scala b/test/pending/pos/t1659.scala deleted file mode 100644 index 10470d66f8..0000000000 --- a/test/pending/pos/t1659.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait Y { type X } -trait W { def u[A](v : Y { type X = A }) : Unit } -class Z extends W { def u[A](v : Y { type X = A }) = null } - diff --git a/test/pending/pos/t1836/J.java b/test/pending/pos/t1836/J.java deleted file mode 100644 index a009a59e21..0000000000 --- a/test/pending/pos/t1836/J.java +++ /dev/null @@ -1 +0,0 @@ -public abstract class J<T> { protected J(T id) { } } diff --git a/test/pending/pos/t1836/S.scala b/test/pending/pos/t1836/S.scala deleted file mode 100644 index 88ce1063e9..0000000000 --- a/test/pending/pos/t1836/S.scala +++ /dev/null @@ -1 +0,0 @@ -class S extends J("") diff --git a/test/pending/pos/t1996.scala b/test/pending/pos/t1996.scala deleted file mode 100644 index 2730128196..0000000000 --- a/test/pending/pos/t1996.scala +++ /dev/null @@ -1,19 +0,0 @@ -object forbug { - val l1 = List(List(ValDef(new A)), List(ValDef(new A))) - for ((e1s, e2s) <- l1.zip(l1); - (e1, e2) <- e1s.zip(e2s)) { - e1.a.doSome(20) -// () - } -} - - -class A { - def doSome(a: Int): this.type = { - println(a) - this - } -} - -case class ValDef(a: A) - diff --git a/test/pending/pos/t2060.scala b/test/pending/pos/t2060.scala deleted file mode 100644 index 3f47259849..0000000000 --- a/test/pending/pos/t2060.scala +++ /dev/null @@ -1,28 +0,0 @@ -object Test { - class Op[I]; - class IntOp extends Op[Int]; - - class Rich(x : Double) { - def + (op : IntOp) = op; - def + [I](op : Op[I]) = op; - def plus [I](op : Op[I]) = op; - } - - implicit def iToRich(x : Double) = - new Rich(x); - - // fails to compile - val failure = 1.0 + new Op[Int]; - - // works as expected -- - // problem isn't in adding new "+" - val a = 1.0 + new IntOp; - - // works as expected -- - // problem isn't in binding type variable I - val b = 1.0 plus new Op[Int]; - - // works as expected -- - // problem isn't in using Rich.+[I](op : Op[I]) - val c = iToRich(1.0) + new Op[Int]; -} diff --git a/test/pending/pos/t2610.scala b/test/pending/pos/t2610.scala deleted file mode 100644 index 8dd4cde66e..0000000000 --- a/test/pending/pos/t2610.scala +++ /dev/null @@ -1,17 +0,0 @@ -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 -} -*/
\ No newline at end of file diff --git a/test/pending/pos/t2619.scala b/test/pending/pos/t2619.scala deleted file mode 100644 index 565bc9572b..0000000000 --- a/test/pending/pos/t2619.scala +++ /dev/null @@ -1,80 +0,0 @@ -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) -}
\ No newline at end of file diff --git a/test/pending/pos/t2660.scala b/test/pending/pos/t2660.scala deleted file mode 100644 index b1908b201b..0000000000 --- a/test/pending/pos/t2660.scala +++ /dev/null @@ -1,25 +0,0 @@ -package hoho - -class G - -class H extends G - -class A[T](x: T) { - - def this(y: G, z: T) = { - this(z) - print(1) - } - - def this(z: H, h: T) = { - this(h) - print(2) - } -} - -object T { - def main(args: Array[String]) { - implicit def g2h(g: G): H = new H - new A(new H, 23) - } -}
\ No newline at end of file diff --git a/test/pending/pos/t2691.scala b/test/pending/pos/t2691.scala deleted file mode 100644 index ba2e52f1fe..0000000000 --- a/test/pending/pos/t2691.scala +++ /dev/null @@ -1,9 +0,0 @@ -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) - } -}
\ No newline at end of file diff --git a/test/pending/pos/t425.scala b/test/pending/pos/t425.scala deleted file mode 100644 index e50c50ac35..0000000000 --- a/test/pending/pos/t425.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Temp{ - case class A(x: Int) - case class B(override val x: Int, y: Double) extends A(x) - - val b: A = B(5, 3.3) - b match { - case B(x, y) => Console.println(y) - case A(x) => Console.println(x) - } -} - diff --git a/test/pending/pos/ticket2251.scala b/test/pending/pos/ticket2251.scala deleted file mode 100644 index 7b6efb0ea0..0000000000 --- a/test/pending/pos/ticket2251.scala +++ /dev/null @@ -1,25 +0,0 @@ - -// Martin: I am not sure this is a solvable problem right now. I'll leave it in pending. -// derived from pos/bug1001 -class A -trait B[T <: B[T]] extends A -class C extends B[C] -class D extends B[D] - -class Data { - // force computing lub of C and D (printLubs enabled:) - -/* -lub of List(D, C) at depth 2 - lub of List(D, C) at depth 1 - lub of List(D, C) at depth 0 - lub of List(D, C) is A - lub of List(D, C) is B[_1] forSome { type _1 >: D with C <: A } -lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { type _1 >: D with C{} <: A } } -*/ -// --> result = WRONG - - // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation - - val data: List[A] = List(new C, new D) -} diff --git a/test/pending/run/bug1697.scala b/test/pending/run/bug1697.scala new file mode 100644 index 0000000000..01590dd405 --- /dev/null +++ b/test/pending/run/bug1697.scala @@ -0,0 +1,19 @@ +class Term +case class Num(n: Int) extends Term +case class Add(x: Term, y: Term) extends Term + +object Value { + def unapply(term: Any): Boolean = true +} + +object Test { + def main(args: Array[String]) { + val term = Add(Num(1), Add(Num(2), Num(3))) + val res = term match { + case Add(Num(x), Num(y)) => "Add(Num, Num)" + case Add(Value(), y) => "Add(Value, ?)" + case _ => "?" + } + assert(res == "Add(Value, ?)") + } +} diff --git a/test/pending/run/bug2365/run b/test/pending/run/bug2365/run deleted file mode 100755 index f3c44ad086..0000000000 --- a/test/pending/run/bug2365/run +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# This script should fail with any build of scala where #2365 -# is not fixed, and otherwise succeed. Failure means running out -# of PermGen space. - -CP=.:/local/lib/java/ivy.jar -# SCALAC=/scala/inst/28/bin/scalac -SCALAC=scalac -RUN_OPTS="-XX:MaxPermSize=25M -verbose:gc" - -$SCALAC -cp $CP *.scala -JAVA_OPTS="${RUN_OPTS}" scala -cp $CP Test diff --git a/test/pending/run/bugs425-and-816.scala b/test/pending/run/bugs425-and-816.scala deleted file mode 100644 index d9267d06af..0000000000 --- a/test/pending/run/bugs425-and-816.scala +++ /dev/null @@ -1,27 +0,0 @@ -object Test { - object bug425 { - case class A(x: Int) - case class B(override val x: Int, y: Double) extends A(x) - - val b: A = B(5, 3.3) - b match { - case B(x, y) => Console.println(y) - case A(x) => Console.println(x) - } - } - - object bug816 { - abstract class Atest(val data: String) - - case class Btest(override val data: String, val b: boolean) extends Atest(data) - - case class Ctest(override val data: String) extends Btest(data, true) - - class testCaseClass { - def test(x: Atest) = x match { - case Ctest(data) => Console.println("C") - case Btest(data, b) => Console.println("B") - } - } - } -} diff --git a/test/pending/run/instanceOfAndTypeMatching.scala b/test/pending/run/instanceOfAndTypeMatching.scala new file mode 100644 index 0000000000..9ab2d6c3c4 --- /dev/null +++ b/test/pending/run/instanceOfAndTypeMatching.scala @@ -0,0 +1,193 @@ +// Summary of incorrect or questionable behavior. +// Full code and successful parts follow. + +object Summary { + class Outer { + class Inner { } + def f() = { class MethodInner ; new MethodInner } + } + + // 1 static issue: + // + // Given method in MethodInner: def g(other: MethodInner) = () + // method1.g(method1) fails to compile with type error. + // + // Note that this cannot be worked around by widening the return type + // of f() because MethodInner is declared inside of f. So there is no way + // I see for a class declared inside a method to receive members of its + // own declared type -- not only the narrow type of those from this + // instance, but ANY members, because there is no Foo#Bar syntax which will + // traverse a method. + // + // 4 runtime issues: + // + // From the outside: inner1.isInstanceOf[outer2.Inner] is true, should (maybe) be false + // From inside inner1: inner2.isInstanceOf[Outer.this.Inner] is true, should (maybe) be false + // From the outside: inner1 match { case _: outer2.Inner => true ... } is true, should definitely be false + // From inside method1: method2 match { case _: MethodInner => true ... } is true, should definitely be false + // + // Note that the fact that every test returns true on instances of MethodInner means + // that it is impossible to draw any type distinction between instances. As far as one + // can tell, they are all of the same type regardless not only of whether they were + // created on the same method invocation but whether they are contained in the same + // instance of Outer. + // + // WRT "same method invocation", see Iterator.duplicate for an example of this. +} + +// Tests + +class Outer { + class Inner { + def passOuter(other: Outer) = () // pass any Outer + def passThisType(other: Outer.this.type) = () // pass only this Outer instance + def passInner(other: Inner) = () // pass only Inners from this Outer instance + def passInner2(other: Outer.this.Inner) = () // same as above + def passInnerSharp(other: Outer#Inner) = () // pass any Inner + + def compareSimpleWithTypeMatch(other: Any) = other match { + case _: Inner => true + case _ => false + } + def compareSimpleWithInstanceOf(other: Any) = other.isInstanceOf[Inner] + + def compareSharpWithTypeMatch(other: Any) = { + other match { + case _: Outer#Inner => true + case _ => false + } + } + def compareSharpWithInstanceOf(other: Any) = other.isInstanceOf[Outer#Inner] + + def comparePathWithTypeMatch(other: Any) = other match { + case _: Outer.this.Inner => true + case _ => false + } + def comparePathWithInstanceOf(other: Any) = other.isInstanceOf[Outer.this.Inner] + } + + def f() = { + class MethodInner { + def passOuter(other: Outer) = () // pass any Outer + def passThisType(other: Outer.this.type) = () // pass only this Outer instance + def passInner(other: Inner) = () // pass only Inners from this Outer instance + def passInner2(other: Outer.this.Inner) = () // same as above + def passInnerSharp(other: Outer#Inner) = () // pass any Inner + def passMethodInner(other: MethodInner) = () // pass only MethodInners from this Outer instance + // is there any way to refer to Outer#MethodInner? Not that there should be. + + def compareWithInstanceOf(other: Any) = other.isInstanceOf[MethodInner] + def compareWithTypeMatch(other: Any) = other match { + case _: MethodInner => true + case _ => false + } + } + + new MethodInner + } +} + +object Test +{ + val outer1 = new Outer + val outer2 = new Outer + val inner1 = new outer1.Inner + val inner2 = new outer2.Inner + val method1 = outer1.f() + val method2 = outer2.f() + + def testInnerStatic = { + // these should all work + inner1.passOuter(outer1) + inner1.passOuter(outer2) + inner1.passThisType(outer1) + inner1.passInner(inner1) + inner1.passInner2(inner1) + inner1.passInnerSharp(inner1) + inner1.passInnerSharp(inner2) + + // these should all fail to compile, and do + // + // inner1.passThisType(outer2) + // inner1.passInner(inner2) + // inner1.passInner2(inner2) + } + def testInnerRuntime = { + println("testInnerRuntime\n") + + List("These should be true under any scenario: ", + inner1.isInstanceOf[outer1.Inner] , + inner1.isInstanceOf[Outer#Inner] , + inner1 match { case _: Outer#Inner => true ; case _ => false } , + inner1 match { case _: outer1.Inner => true ; case _ => false } , + inner1.compareSharpWithTypeMatch(inner2) , + inner1.compareSharpWithInstanceOf(inner2) + ) foreach println + + List("These should be true under current proposal: ", + inner1.compareSimpleWithInstanceOf(inner2) + ) foreach println + + List("These should be false under current proposal: ", + inner1.compareSimpleWithTypeMatch(inner2) , + inner1.comparePathWithTypeMatch(inner2) + ) foreach println + + List("These return true but I think should return false: ", + inner1.isInstanceOf[outer2.Inner] , // true + inner1.comparePathWithInstanceOf(inner2) // true + ) foreach println + + List("These are doing the wrong thing under current proposal", + inner1 match { case _: outer2.Inner => true ; case _ => false } // should be false + ) foreach println + } + + def testMethodInnerStatic = { + // these should all work + method1.passOuter(outer1) + method1.passOuter(outer2) + method1.passThisType(outer1) + method1.passInner(inner1) + method1.passInner2(inner1) + method1.passInnerSharp(inner1) + method1.passInnerSharp(inner2) + // This fails with: + // + // a.scala:114: error: type mismatch; + // found : Test.method1.type (with underlying type MethodInner forSome { type MethodInner <: java.lang.Object with ScalaObject{def passOuter(other: Outer): Unit; def passThisType(other: Test.outer1.type): Unit; def passInner(other: Test.outer1.Inner): Unit; def passInner2(other: Test.outer1.Inner): Unit; def passInnerSharp(other: Outer#Inner): Unit; def passMethodInner(other: MethodInner): Unit} }) + // required: MethodInner where type MethodInner <: java.lang.Object with ScalaObject{def passOuter(other: Outer): Unit; def passThisType(other: Test.outer1.type): Unit; def passInner(other: Test.outer1.Inner): Unit; def passInner2(other: Test.outer1.Inner): Unit; def passInnerSharp(other: Outer#Inner): Unit; def passMethodInner(other: MethodInner): Unit} + // method1.passMethodInner(method1) + // ^ + // method1.passMethodInner(method1) + + // these should all fail to compile, and do + // + // method1.passThisType(outer2) + // method1.passInner(inner2) + // method1.passInner2(inner2) + // method1.passMethodInner(method2) + } + + def testMethodInnerRuntime = { + println("\ntestMethodInnerRuntime\n") + + List("These should be true under any scenario: ", + method1.compareWithInstanceOf(method1) , + method1.compareWithTypeMatch(method1) + ) foreach println + + List("These should be true under current proposal: ", + method1.compareWithInstanceOf(method2) + ) foreach println + + List("These are doing the wrong thing under current proposal", + method1.compareWithTypeMatch(method2) // should be false + ) foreach println + } + + def main(args: Array[String]): Unit = { + testInnerRuntime + testMethodInnerRuntime + } +} diff --git a/test/pending/run/subarray.check b/test/pending/run/subarray.check deleted file mode 100644 index 814f4a4229..0000000000 --- a/test/pending/run/subarray.check +++ /dev/null @@ -1,2 +0,0 @@ -one -two diff --git a/test/pending/run/bug2365/bug2365.javaopts b/test/pending/script/bug2365.javaopts index 357e033c1c..357e033c1c 100644 --- a/test/pending/run/bug2365/bug2365.javaopts +++ b/test/pending/script/bug2365.javaopts diff --git a/test/pending/run/bug2365/Test.scala b/test/pending/script/bug2365/Test.scala index 92b58f4a25..53581d256b 100644 --- a/test/pending/run/bug2365/Test.scala +++ b/test/pending/script/bug2365/Test.scala @@ -20,11 +20,11 @@ object Test def test(withF0: StructF0 => Int): Int = { // Some large jar - val ivyJar = File("/local/lib/java/ivy.jar").toURL + val jar = File("../../../../lib/scalacheck.jar").toURL // load a class in a separate loader that will be passed to A - val loader = new java.net.URLClassLoader(Array(File(".").toURL, ivyJar)) + val loader = new java.net.URLClassLoader(Array(File(".").toURL, jar)) // load a real class to fill perm gen space - Class.forName("org.apache.ivy.Ivy", true, loader).newInstance + Class.forName("org.scalacheck.Properties", true, loader).newInstance // create a class from another class loader with an apply: Int method val b = Class.forName("B", true, loader).newInstance diff --git a/test/pending/script/bug2365/bug2365.scala b/test/pending/script/bug2365/bug2365.scala new file mode 100755 index 0000000000..b5e05325cf --- /dev/null +++ b/test/pending/script/bug2365/bug2365.scala @@ -0,0 +1,9 @@ +#!/bin/sh +# +# This script should fail with any build of scala where #2365 +# is not fixed, and otherwise succeed. Failure means running out +# of PermGen space. +# + +scalac -cp .:/local/lib/java/ivy.jar Test.scala +JAVA_OPTS="-XX:MaxPermSize=25M -verbose:gc" scalac -cp $CP Test |