diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-07 19:09:52 +0200 |
---|---|---|
committer | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-05-20 13:38:49 +0200 |
commit | 27081ae59ba5b00b6ae05bb3cdd9c3ff7db0a28e (patch) | |
tree | ab350b5ef2d7b9adc29fe715be2efb4681970127 /tests/untried/pos | |
parent | fb3dba1bac13a755d2304928cbd49e7dde6f1bf9 (diff) | |
download | dotty-27081ae59ba5b00b6ae05bb3cdd9c3ff7db0a28e.tar.gz dotty-27081ae59ba5b00b6ae05bb3cdd9c3ff7db0a28e.tar.bz2 dotty-27081ae59ba5b00b6ae05bb3cdd9c3ff7db0a28e.zip |
Tests pos/23xx to 24xx.
Diffstat (limited to 'tests/untried/pos')
37 files changed, 0 insertions, 499 deletions
diff --git a/tests/untried/pos/t2208_pos.scala b/tests/untried/pos/t2208_pos.scala deleted file mode 100644 index dd6d686ba..000000000 --- a/tests/untried/pos/t2208_pos.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test { - class A - - class B[X] - type Alias[X <: A] = B[X] - - val foo: B[A] = new Alias[A] // check that type aliases can be instantiated -} diff --git a/tests/untried/pos/t2234.scala b/tests/untried/pos/t2234.scala deleted file mode 100644 index 218e9f5e5..000000000 --- a/tests/untried/pos/t2234.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - val res0 = 1 #:: Stream.empty - res0 match { case 1 #:: xs => xs } -} diff --git a/tests/untried/pos/t2260.scala b/tests/untried/pos/t2260.scala deleted file mode 100644 index 4e4cc5ab2..000000000 --- a/tests/untried/pos/t2260.scala +++ /dev/null @@ -1,10 +0,0 @@ -package top - -class Text(val value: String) extends Ordered[Text] { - def compare(that: Text) = value.compare(that.value) -} - -object Index { - import scala.collection.immutable.TreeMap - val tree = TreeMap.empty[Text, String] -} diff --git a/tests/untried/pos/t2261.scala b/tests/untried/pos/t2261.scala deleted file mode 100644 index 06360d500..000000000 --- a/tests/untried/pos/t2261.scala +++ /dev/null @@ -1,9 +0,0 @@ -class Bob[T] -object Test { - implicit def foo2bar[T](xs: List[T]): Bob[T] = new Bob[T] - var x: Bob[Int] = null - x = List(1,2,3) - // the problem here was that somehow the type variable that was used to infer the type argument for List.apply - // would accumulate several conflicting constraints - // can't reproduce with -} diff --git a/tests/untried/pos/t229.scala b/tests/untried/pos/t229.scala deleted file mode 100644 index 72ddfa74f..000000000 --- a/tests/untried/pos/t229.scala +++ /dev/null @@ -1,3 +0,0 @@ -class Test extends java.util.ArrayList[Object] { - override def add(index: Int, element: java.lang.Object): Unit = {} -} diff --git a/tests/untried/pos/t2293.scala b/tests/untried/pos/t2293.scala deleted file mode 100644 index 536d4ec3d..000000000 --- a/tests/untried/pos/t2293.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.collection.JavaConversions._ - -object Test { - val m: java.util.Map[String,String] = collection.mutable.Map("1"->"2") -} diff --git a/tests/untried/pos/t2305.scala b/tests/untried/pos/t2305.scala deleted file mode 100644 index 3338ab911..000000000 --- a/tests/untried/pos/t2305.scala +++ /dev/null @@ -1,26 +0,0 @@ -import java.util.ArrayList - -trait Bind[Z[_]] - -class MySerializable[X] extends java.io.Serializable - -object Bind { - implicit val JavaArrayListBind: Bind[ArrayList] = new Bind[ArrayList] {} - implicit val MySerializableBind: Bind[MySerializable] = new Bind[MySerializable] {} -} - -object works { - // this works fine: - def runbind(implicit bind: Bind[MySerializable]): Unit = {} - runbind -} - -object breaks { - def runbind(implicit bind: Bind[ArrayList]): Unit = {} - runbind - /*java.lang.AssertionError: assertion failed: java.io.Serializable - at scala.Predef$.assert(Predef.scala:107) - at scala.tools.nsc.symtab.Types$TypeRef.transform(Types.scala:1417) - at scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1559) - */ -} diff --git a/tests/untried/pos/t2310.scala b/tests/untried/pos/t2310.scala deleted file mode 100644 index 68912b496..000000000 --- a/tests/untried/pos/t2310.scala +++ /dev/null @@ -1,38 +0,0 @@ -import scala.Stream._ - -object consistencyError { - /* this gives an error: - Consistency problem compiling (virtual file)! - Trying to call method body%1(List(scala.collection.immutable.Stream[A])) with arguments (List(tp2, temp6, temp5)) - case (l #:: ls, rs) => None - ^ - scala.tools.nsc.symtab.Types$TypeError: too many arguments for method body%1: (val rs: scala.collection.immutable.Stream[A])None.type - - two errors found - vss(0) = - args = List(tp2, temp6, temp5) - vss(1) = value rs, value ls, value l - args = List(tp2, temp6, temp5) - targets(0) = FinalState(,scala.None) - targets(1) = FinalState(,scala.None) - labels(1) = method body%1 - labels(0) = method body%0 - bx = 1 - label.tpe = (val rs: scala.collection.immutable.Stream[A])None.type - */ - def crash[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match { - case (Stream.Empty, Stream.Empty) => None - case (l #:: ls, rs) => None - } - - // These work - // def works1[A](lefts: Stream[A]) = lefts match { - // case Stream.Empty => None - // case l #:: ls => None - // } - // - // def works2[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match { - // case (Stream.Empty, Stream.Empty) => None - // case (ls, rs) => None - // } -} diff --git a/tests/untried/pos/t2331.scala b/tests/untried/pos/t2331.scala deleted file mode 100644 index a7f80ac98..000000000 --- a/tests/untried/pos/t2331.scala +++ /dev/null @@ -1,11 +0,0 @@ -trait C { - def m[T]: T -} - -object Test { - val o /*: C --> no crash*/ = new C { - def m[T]: Nothing /*: T --> no crash*/ = sys.error("omitted") - } - - o.m[Nothing] -} diff --git a/tests/untried/pos/t2377/Q.java b/tests/untried/pos/t2377/Q.java deleted file mode 100644 index e3d11c70e..000000000 --- a/tests/untried/pos/t2377/Q.java +++ /dev/null @@ -1,12 +0,0 @@ -public final class Q { - public static final class Stage { - public static Builder newBuilder() { return new Builder(); } - public static final class Builder { } - public Builder toBuilder() { return newBuilder(); } - } - public static final class WorkUnit { - public static Builder newBuilder() { return new Builder(); } - public static final class Builder { } - public Builder toBuilder() { return newBuilder(); } - } -} diff --git a/tests/untried/pos/t2377/a.scala b/tests/untried/pos/t2377/a.scala deleted file mode 100644 index bda59ce0d..000000000 --- a/tests/untried/pos/t2377/a.scala +++ /dev/null @@ -1,8 +0,0 @@ -import Q._ - -class Bop(var workUnit: WorkUnit) { - def addStages(stageBuilder: Stage.Builder): Unit = { - val builder = workUnit.toBuilder - () - } -} diff --git a/tests/untried/pos/t2399.scala b/tests/untried/pos/t2399.scala deleted file mode 100644 index a99998a0a..000000000 --- a/tests/untried/pos/t2399.scala +++ /dev/null @@ -1,14 +0,0 @@ -trait That1[A] -trait That2[A, R <: That2[A, R]] - -trait T[A, This >: Null <: That1[A] with T[A, This]] extends That2[A, This] { - self: This => - - private var next: This = _ - def isEmpty = next eq null - - def length: Int = { - def loop(x: This, cnt: Int): Int = if (x.isEmpty) cnt else loop(x.next, cnt + 1) - loop(self, 0) - } -} diff --git a/tests/untried/pos/t2405.scala b/tests/untried/pos/t2405.scala deleted file mode 100644 index 224b2ce83..000000000 --- a/tests/untried/pos/t2405.scala +++ /dev/null @@ -1,23 +0,0 @@ -object A { implicit val x: Int = 1 } - -// Problem as stated in the ticket. -object Test1 { - import A.{x => y} - implicitly[Int] -} - -// Testing for the absense of shadowing #1. -object Test2 { - import A.{x => y} - val x = 2 - implicitly[Int] -} - -// Testing for the absense of shadowing #2. -object Test3 { - { - import A.{x => y} - def x: Int = 0 - implicitly[Int] - } -} diff --git a/tests/untried/pos/t2409/J.java b/tests/untried/pos/t2409/J.java deleted file mode 100644 index 6b7c45ff6..000000000 --- a/tests/untried/pos/t2409/J.java +++ /dev/null @@ -1,4 +0,0 @@ -class J { - static class J2 { } - J(J2 j2) { } -} diff --git a/tests/untried/pos/t2409/t2409.scala b/tests/untried/pos/t2409/t2409.scala deleted file mode 100644 index 0412f7d82..000000000 --- a/tests/untried/pos/t2409/t2409.scala +++ /dev/null @@ -1 +0,0 @@ -object S { new J(null) } diff --git a/tests/untried/pos/t2413/TestJava.java b/tests/untried/pos/t2413/TestJava.java deleted file mode 100644 index 252c01fbc..000000000 --- a/tests/untried/pos/t2413/TestJava.java +++ /dev/null @@ -1,7 +0,0 @@ -package pack; - -public class TestJava { - protected String repeatParam(String ... items) { - return "nothing"; - } -} diff --git a/tests/untried/pos/t2413/TestScalac.scala b/tests/untried/pos/t2413/TestScalac.scala deleted file mode 100644 index 098e852dd..000000000 --- a/tests/untried/pos/t2413/TestScalac.scala +++ /dev/null @@ -1,23 +0,0 @@ -import pack.TestJava - -class Foo extends TestJava { - - // THIS METHOD YIELDS TO CRASH -/* def foomethod : Option[String] => Unit = { - case None => - val path = repeatParam("s","a","b","c") - () - case Some(error) => - () - } - - // THIS IS OK - def foomethod2 : String = repeatParam("s","a"); - - // THIS IS OK - val aVal = repeatParam("1","2","3") */ - - // THIS YIELDS TO CRASH - for (a <- 1 to 4 ; anotherVal = repeatParam("1","2","3")) - yield anotherVal -} diff --git a/tests/untried/pos/t2421.scala b/tests/untried/pos/t2421.scala deleted file mode 100644 index 2544a1cb3..000000000 --- a/tests/untried/pos/t2421.scala +++ /dev/null @@ -1,14 +0,0 @@ -object Test { - abstract class <~<[-From, +To] extends (From => To) - implicit def trivial[A]: A <~< A = sys.error("") - - - trait Forcible[T] - implicit val forcibleInt: (Int <~< Forcible[Int]) = sys.error("") - - def headProxy[P <: Forcible[Int]](implicit w: Int <~< P): P = sys.error("") - - headProxy - // trivial[Int] should not be considered a valid implicit, since w would have type Int <~< Int, - // and headProxy's type parameter P cannot be instantiated to Int -} diff --git a/tests/untried/pos/t2421_delitedsl.scala b/tests/untried/pos/t2421_delitedsl.scala deleted file mode 100644 index 2580592d9..000000000 --- a/tests/untried/pos/t2421_delitedsl.scala +++ /dev/null @@ -1,37 +0,0 @@ -trait DeliteDSL { - abstract class <~<[-From, +To] extends (From => To) - implicit def trivial[A]: A <~< A = new (A <~< A) {def apply(x: A) = x} - - trait Forcible[T] - object Forcible { - def factory[T](f: T => Forcible[T]) = new (T <~< Forcible[T]){def apply(x: T) = f(x)} - } - - case class DeliteInt(x: Int) extends Forcible[Int] - implicit val forcibleInt: DeliteDSL.this.<~<[Int,DeliteDSL.this.Forcible[Int]] = Forcible.factory(DeliteInt(_: Int)) - - import scala.collection.Traversable - class DeliteCollection[T](val xs: Traversable[T]) { - // must use existential in bound of P, instead of T itself, because we cannot both have: - // Test.x below: DeliteCollection[T=Int] -> P=DeliteInt <: Forcible[T=Int], as T=Int <~< P=DeliteInt - // Test.xAlready below: DeliteCollection[T=DeliteInt] -> P=DeliteInt <: Forcible[T=DeliteInt], as T=DeliteInt <~< P=DeliteInt - // this would required DeliteInt <: Forcible[Int] with Forcible[DeliteInt] - - def headProxy[P <: Forcible[_]](implicit w: T <~< P): P = xs.head - } - // If T is already a proxy (it is forcible), the compiler should use - // forcibleIdentity to deduce that P=T. If T is Int, the compiler - // should use intToForcible to deduce that P=DeliteInt. - // - // Without this feature, the user must write 'xs.proxyOfFirst[DeliteInt]', - // with the feature they can write 'xs.proxyOfFirst', which is shorter and - // avoids exposing internal DELITE types to the world. - - object Test { - val x = new DeliteCollection(List(1,2,3)).headProxy - // inferred: val x: Forcible[Int] = new DeliteCollection[Int](List.apply[Int](1, 2, 3)).headProxy[Forcible[Int]](forcibleInt); - - val xAlready = new DeliteCollection(List(DeliteInt(1),DeliteInt(2),DeliteInt(3))).headProxy - // inferred: val xAlready: DeliteInt = new DeliteCollection[DeliteInt](List.apply[DeliteInt](DeliteInt(1), DeliteInt(2), DeliteInt(3))).headProxy[DeliteInt](trivial[DeliteInt]); - } -} diff --git a/tests/untried/pos/t2421b_pos.scala b/tests/untried/pos/t2421b_pos.scala deleted file mode 100644 index 679b8a8d6..000000000 --- a/tests/untried/pos/t2421b_pos.scala +++ /dev/null @@ -1,19 +0,0 @@ -object Test { - class A - class B - class C - class F[X] - - def f(implicit aa: F[A]) = println(aa) - - implicit def a : F[A] = new F[A]() - implicit def b[X <: B]: Test.F[X] = new F[X]() - - f -} -/* bug: -error: ambiguous implicit values: - both method b in object Test1 of type [X <: Test1.B]Test1.F[X] - and method a in object Test1 of type => Test1.F[Test1.A] - match expected type Test1.F[Test1.A] -*/ diff --git a/tests/untried/pos/t2421c.scala b/tests/untried/pos/t2421c.scala deleted file mode 100644 index bd24cacd7..000000000 --- a/tests/untried/pos/t2421c.scala +++ /dev/null @@ -1,17 +0,0 @@ -object Test { - class A - class B - class C - class F[X] - - def f(implicit aa: F[A]) = println(aa) - - implicit def a : F[A] = new F[A]() - - // generalised from t2421b to verify we check enough - class G[X] - implicit def g[X]: Test.G[X] = new G[X]() - implicit def b[X <: B](implicit mx: G[X]): Test.F[X] = new F[X]() - - f -} diff --git a/tests/untried/pos/t2425.scala b/tests/untried/pos/t2425.scala deleted file mode 100755 index 477d5467a..000000000 --- a/tests/untried/pos/t2425.scala +++ /dev/null @@ -1,15 +0,0 @@ -trait B -class D extends B -object Test extends App { - def foo[T](bar: T) = { - bar match { - case _: Array[Array[_]] => println("array 2d") - case _: Array[_] => println("array 1d") - case _ => println("something else") - } - } - foo(Array.fill(10)(2)) - foo(Array.fill(10, 10)(2)) - foo(Array.fill(10, 10, 10)(2)) - foo(List(1, 2, 3)) -} diff --git a/tests/untried/pos/t2429.scala b/tests/untried/pos/t2429.scala deleted file mode 100755 index 4cda3bde1..000000000 --- a/tests/untried/pos/t2429.scala +++ /dev/null @@ -1,25 +0,0 @@ -object Msg { - trait T - - trait TSeq - - object TSeq { - implicit def fromSeq(s: Seq[T]): TSeq = sys.error("stub") - } - - def render: Unit = { - val msgs: TSeq = (List[(Any, Any)]().flatMap { - case (a, b) => { - a match { - case _ => b match { - case _ => sys.error("stub") - } - } - } - } /*: Seq[T] Adding this type annotation avoids the compile error.*/) - } -} -object Oops { - implicit def someImplicit(s: Seq[_]): String = sys.error("stub") - def item: String = Nil map { case e: Any => e } -} diff --git a/tests/untried/pos/t2433/A.java b/tests/untried/pos/t2433/A.java deleted file mode 100755 index 340690c40..000000000 --- a/tests/untried/pos/t2433/A.java +++ /dev/null @@ -1,4 +0,0 @@ -class A223 extends B223.Inner { - static class Inner {} - void foo() {} -}
\ No newline at end of file diff --git a/tests/untried/pos/t2433/B.java b/tests/untried/pos/t2433/B.java deleted file mode 100755 index 151dd71ca..000000000 --- a/tests/untried/pos/t2433/B.java +++ /dev/null @@ -1,4 +0,0 @@ -class B223 { - static class Inner {} - void m(A223.Inner x) {} -}
\ No newline at end of file diff --git a/tests/untried/pos/t2433/Test.scala b/tests/untried/pos/t2433/Test.scala deleted file mode 100755 index 02fd89b64..000000000 --- a/tests/untried/pos/t2433/Test.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - (new A223).foo() -} diff --git a/tests/untried/pos/t2435.scala b/tests/untried/pos/t2435.scala deleted file mode 100644 index 697e9e1f2..000000000 --- a/tests/untried/pos/t2435.scala +++ /dev/null @@ -1,27 +0,0 @@ -object Bug { - abstract class FChain { - type T - - def chain(constant:String) = - new FConstant[this.type](constant, this) //removing [this.type], everything compiles - } - - case class FConstant[E <: FChain](constant:String, tail:E) extends FChain { - type T = tail.T - } - - object FNil extends FChain { - type T = Unit - } - -} - -object Test { - import Bug._ - println("Compiles:") - val a1 = FNil.chain("a").chain("a") - val a2 = a1.chain("a") - - println("\nDoesn't compile:") - val a = FNil.chain("a").chain("a").chain("a") -} diff --git a/tests/untried/pos/t2441pos.scala b/tests/untried/pos/t2441pos.scala deleted file mode 100644 index 25eb2232c..000000000 --- a/tests/untried/pos/t2441pos.scala +++ /dev/null @@ -1,8 +0,0 @@ -abstract class A { - private def foo = List(1, 2) -} -trait B extends A { - private def foo = List("a", "b") - // However it compiles correctly if the type is given: - // private def foo: List[String] = List("a", "b") -} diff --git a/tests/untried/pos/t2444.scala b/tests/untried/pos/t2444.scala deleted file mode 100644 index fac1e95d0..000000000 --- a/tests/untried/pos/t2444.scala +++ /dev/null @@ -1,15 +0,0 @@ -object Test { - - trait Foo - - class Bar { - object baz extends Foo - } - - def frob[P1, P2<:Foo](f:P1 => P2) = () - - def main(args:Array[String]) : Unit = { - frob((p:Bar) => p.baz) - } - -} diff --git a/tests/untried/pos/t245.scala b/tests/untried/pos/t245.scala deleted file mode 100644 index 570ac4178..000000000 --- a/tests/untried/pos/t245.scala +++ /dev/null @@ -1,18 +0,0 @@ -class Value {} - -object Test { - - implicit def view(v: Value): Int = 0 - - def foo(i: Int): Int = 0 - - def fun0 : Value = null - def fun0(i: Int ): Value = null - - def fun1(i: Int ): Value = null - def fun1(l: Long): Value = null - - foo(fun0 ); - foo(fun1(new Value)); - -} diff --git a/tests/untried/pos/t2454.scala b/tests/untried/pos/t2454.scala deleted file mode 100644 index 00f2e6f67..000000000 --- a/tests/untried/pos/t2454.scala +++ /dev/null @@ -1,25 +0,0 @@ -package am; - -trait One[M[_]] { - val x : Int -} - -trait Two[M[_,_]] { - val x : Int -} - -object Test { - // Works. - val x = new Two[Map] { - val x = 5 - } - - val o = new One[java.util.List] { - val x = 1 - } - - // Does not work - val y = new Two[java.util.concurrent.ConcurrentHashMap] { - val x = 3 - } -} diff --git a/tests/untried/pos/t2464/JavaOne.java b/tests/untried/pos/t2464/JavaOne.java deleted file mode 100644 index ff36868a0..000000000 --- a/tests/untried/pos/t2464/JavaOne.java +++ /dev/null @@ -1,5 +0,0 @@ -class ClassTwo { - public static class Child { - public void func2() {return ;} - } -} diff --git a/tests/untried/pos/t2464/ScalaOne_1.scala b/tests/untried/pos/t2464/ScalaOne_1.scala deleted file mode 100644 index 1caf8ecae..000000000 --- a/tests/untried/pos/t2464/ScalaOne_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -class ScalaClassOne extends ClassTwo.Child { - def func4() = { - func2 - } -} - diff --git a/tests/untried/pos/t2464/t2464_2.scala b/tests/untried/pos/t2464/t2464_2.scala deleted file mode 100644 index 13a52c952..000000000 --- a/tests/untried/pos/t2464/t2464_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - val c1 = new ScalaClassOne -} diff --git a/tests/untried/pos/t247.scala b/tests/untried/pos/t247.scala deleted file mode 100644 index fdcafeb2c..000000000 --- a/tests/untried/pos/t247.scala +++ /dev/null @@ -1,26 +0,0 @@ -class Order[t](less:(t,t) => Boolean,equal:(t,t) => Boolean) {} - -trait Map[A, B] extends scala.collection.Map[A, B] { - val factory:MapFactory[A] -} -abstract class MapFactory[A] { - def Empty[B]:Map[A,B]; -} - -class TreeMapFactory[KEY](newOrder:Order[KEY]) extends MapFactory[KEY] { - val order = newOrder; - def Empty[V] = new TreeMap[KEY,V](new TreeMapFactory[KEY](order)); -} - -class Tree[KEY,Entry](order:Order[KEY]) { - def size =0; -} - -class TreeMap[KEY,VALUE](_factory:TreeMapFactory[KEY]) extends Tree[KEY,Tuple2[KEY,VALUE]](_factory.order) with scala.collection.DefaultMap[KEY, VALUE] with Map[KEY, VALUE] { - val factory = _factory - val order = _factory.order; - def this(newOrder:Order[KEY]) = this(new TreeMapFactory[KEY](newOrder)); - def get(key:KEY) = null; - def iterator:Iterator[Tuple2[KEY,VALUE]] = null; - override def size = super[Tree].size -} diff --git a/tests/untried/pos/t2484.scala b/tests/untried/pos/t2484.scala deleted file mode 100755 index 15165c247..000000000 --- a/tests/untried/pos/t2484.scala +++ /dev/null @@ -1,19 +0,0 @@ -import concurrent.ExecutionContext.Implicits.global - -class Admin extends javax.swing.JApplet { - val jScrollPane = new javax.swing.JScrollPane (null, 0, 0) - def t2484: Unit = { - scala.concurrent.Future {jScrollPane.synchronized { - def someFunction () = {} - //scala.concurrent.ops.spawn {someFunction ()} - jScrollPane.addComponentListener (new java.awt.event.ComponentAdapter {override def componentShown (e: java.awt.event.ComponentEvent) = { - someFunction (); jScrollPane.removeComponentListener (this)}}) - }} - } -} -// t2630.scala -object Test { - def meh(xs: List[Any]): Unit = { - xs map { x => (new AnyRef {}) } - } -} diff --git a/tests/untried/pos/t2486.scala b/tests/untried/pos/t2486.scala deleted file mode 100644 index 69fe4c127..000000000 --- a/tests/untried/pos/t2486.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A[T] -class B extends A[Int] -class C[T] extends A[T] { def f(t: A[T]) = t match { case x: B => () } } |