diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-06 10:34:40 +0200 |
---|---|---|
committer | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-05-20 13:38:48 +0200 |
commit | 2d3c79f7cf3e79b592c7e479d262e8d3f9b04959 (patch) | |
tree | 34fe9918f20f17f2426a1dc47c6678a863f20f33 /tests/untried/pos | |
parent | 093774e181e878308551226f6a0b990bf7de8077 (diff) | |
download | dotty-2d3c79f7cf3e79b592c7e479d262e8d3f9b04959.tar.gz dotty-2d3c79f7cf3e79b592c7e479d262e8d3f9b04959.tar.bz2 dotty-2d3c79f7cf3e79b592c7e479d262e8d3f9b04959.zip |
Tests pos 20xx 21xx
Diffstat (limited to 'tests/untried/pos')
26 files changed, 0 insertions, 381 deletions
diff --git a/tests/untried/pos/t201.scala b/tests/untried/pos/t201.scala deleted file mode 100644 index b0c6b8da4..000000000 --- a/tests/untried/pos/t201.scala +++ /dev/null @@ -1,7 +0,0 @@ -class C[a] { def f: a = f; } -class D[b] { class E extends C[b]; } -object Test { - val d = new D[Int]; - def e = new d.E; - e.f; -} diff --git a/tests/untried/pos/t2018.scala b/tests/untried/pos/t2018.scala deleted file mode 100644 index 198b4be42..000000000 --- a/tests/untried/pos/t2018.scala +++ /dev/null @@ -1,15 +0,0 @@ -class A { - val b = new B - - def getChildren = List(new A).iterator - - class B { - private def check = true - - private def getAncestor(p: A): A = { - val c = (p.getChildren.find(_.b.check)) match {case Some(d) => d case None => p} - - if (c == p) p else c.b.getAncestor(c) - } - } -} diff --git a/tests/untried/pos/t2023.scala b/tests/untried/pos/t2023.scala deleted file mode 100644 index 21c6fc96a..000000000 --- a/tests/untried/pos/t2023.scala +++ /dev/null @@ -1,16 +0,0 @@ -trait C[A] - -object C { - implicit def ipl[A](implicit from: A => Ordered[A]): C[A] = null -} - -object P { - def foo[A](i: A, j: A)(implicit c: C[A]): Unit = () -} - -class ImplicitChainTest { - def testTrivial: Unit = { - P.foo('0', '9') - P.foo('0', '9') - } -} diff --git a/tests/untried/pos/t2038.scala b/tests/untried/pos/t2038.scala deleted file mode 100644 index 8c8ca44da..000000000 --- a/tests/untried/pos/t2038.scala +++ /dev/null @@ -1,5 +0,0 @@ -class Test { - List(Some(classOf[java.lang.Integer]), Some(classOf[Int])).map { - case Some(f: Class[_]) => f.cast(???) - } -} diff --git a/tests/untried/pos/t2060.scala b/tests/untried/pos/t2060.scala deleted file mode 100755 index 0b9079062..000000000 --- a/tests/untried/pos/t2060.scala +++ /dev/null @@ -1,44 +0,0 @@ -/* The problem here is that we cannot insert an implicit to - * add a polymorphic method which is then instantiated to the - * right type. When searching for the implicit in the `fails to compile - * line': - * - * val failure = 1.0 + new Op[Int] - * - * we reduce the problem to finding a function from Double to - * {+: _ >: Op[Int] <: Any}, that is, a method which takes - * an argument which is an Op[Int] or a supertype thereof. - * Class Rich is not a subtype of this structural record, because - * polymorphic method instantiation is not contained in subtyping. - * That is: The method type [I](op : Op[I]): Op[I] is not a subtype - * of (Op[Int]): Op[Int]. - * At present it is unclear whether this problem can be solved. - */ -object Test { - class Op[I]; - class IntOp extends Op[Int]; - - class Rich(x : Double) { - def + (op : IntOp): IntOp = op; - def + [I](op : Op[I]): Op[I] = op; - def plus [I](op : Op[I]): Op[I] = op; - } - - implicit def iToRich(x : Double): Test.Rich = - new Rich(x); - - // fails to compile - val x = 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/tests/untried/pos/t2066-2.10-compat.flags b/tests/untried/pos/t2066-2.10-compat.flags deleted file mode 100644 index 94c805674..000000000 --- a/tests/untried/pos/t2066-2.10-compat.flags +++ /dev/null @@ -1 +0,0 @@ --Xsource:2.10 diff --git a/tests/untried/pos/t2066-2.10-compat.scala b/tests/untried/pos/t2066-2.10-compat.scala deleted file mode 100644 index fb8103e4a..000000000 --- a/tests/untried/pos/t2066-2.10-compat.scala +++ /dev/null @@ -1,71 +0,0 @@ -import language._ -trait A1 { - def f[T[_]] = () -} - -trait B1 extends A1 { - override def f[T[+_]] = () -} - -trait C1 extends A1 { - override def f[T[-_]] = () -} - - -trait A2 { - def f[T[+_]] = () -} - -trait B2 extends A2 { - override def f[T[_]] = () // okay -} - -trait C2 extends A2 { - override def f[T[-_]] = () -} - - -trait A3 { - def f[T[-_]] = () -} - -trait B3 extends A3 { - override def f[T[_]] = () // okay -} - -trait C3 extends A3 { - override def f[T[-_]] = () -} - - -trait A4 { - def f[T[X[+_]]] = () -} - -trait B4 extends A4 { - override def f[T[X[_]]] = () -} - -trait A5 { - def f[T[X[-_]]] = () -} - -trait B5 extends A5 { - override def f[T[X[_]]] = () -} - - - -trait A6 { - def f[T[X[_]]] = () -} - -trait B6 extends A6 { - override def f[T[X[+_]]] = () // okay -} -trait C6 extends A6 { - override def f[T[X[_]]] = () // okay -} -trait D6 extends A6 { - override def f[T[X[-_]]] = () -} diff --git a/tests/untried/pos/t2066.scala b/tests/untried/pos/t2066.scala deleted file mode 100644 index 30cb99d45..000000000 --- a/tests/untried/pos/t2066.scala +++ /dev/null @@ -1,25 +0,0 @@ -trait A1 { - def f[T[+_]] = () -} - -trait B1 extends A1 { - override def f[T[_]] = () -} - - -trait A2 { - def f[T[-_]] = () -} - -trait B2 extends A2 { - override def f[T[_]] = () -} - - -trait A3 { - def f[T[X[_]]] = () -} - -trait B3 extends A3 { - override def f[T[X[+_]]] = () -} diff --git a/tests/untried/pos/t2081.scala b/tests/untried/pos/t2081.scala deleted file mode 100644 index 395134f71..000000000 --- a/tests/untried/pos/t2081.scala +++ /dev/null @@ -1,11 +0,0 @@ -object ScalaForRubyists { - class RichInt(n: Int) { - def days = 1000*60*60*24*n - } - - implicit def RichInt(n: Int): RichInt = new RichInt(n) - - val x = 10.days - // a couple parser corner cases I wanted not to break - val y = 5.0e0 + 5e7 -} diff --git a/tests/untried/pos/t2082.scala b/tests/untried/pos/t2082.scala deleted file mode 100755 index a7ee3789b..000000000 --- a/tests/untried/pos/t2082.scala +++ /dev/null @@ -1,39 +0,0 @@ - -trait Mapper[T <: Mapper[T]] - -trait KeyedMapper[KeyType, T <: KeyedMapper[KeyType, T]] extends Mapper[T] - - -trait KeyedMetaMapper[KeyType, T <: KeyedMapper[KeyType, T]] - -trait MappedForeignKey[KeyType, Owner <: Mapper[Owner], Other <: KeyedMapper[KeyType, Other]] - -trait IdPK - -class TestSubject extends KeyedMapper[Long, TestSubject] with IdPK - -class TestRun extends KeyedMapper[Long, TestRun] with IdPK { - object testSubject extends MappedForeignKey[Long, TestRun, TestSubject] -} - -object TestRun extends TestRun with KeyedMetaMapper[Long, TestRun] - -class MetaTestSubject extends TestSubject with KeyedMetaMapper[Long, TestSubject] -object TestSubject extends MetaTestSubject - -object Main { - - def oneToOneJoin[PType <: KeyedMapper[Long, PType] with IdPK, - CType <: KeyedMapper[Long, CType] with IdPK, - CMetaType <: CType with KeyedMetaMapper[Long, CType], - FKType <: MappedForeignKey[Long, PType, CType]] - (parents: List[PType], metaMapper: CMetaType, keyGetter: (PType) => FKType ): - Map[Long, CType] = Map.empty - - def callIt: Unit = { - oneToOneJoin[TestRun, TestSubject, MetaTestSubject, - MappedForeignKey[Long, TestRun, TestSubject]]( - List(), TestSubject, (tr: TestRun) => tr.testSubject) - } - -} diff --git a/tests/untried/pos/t2094.scala b/tests/untried/pos/t2094.scala deleted file mode 100644 index 6b6c4f077..000000000 --- a/tests/untried/pos/t2094.scala +++ /dev/null @@ -1,31 +0,0 @@ -object Test extends App { - // compiles: - Map[Int, Value]( - 0 -> KnownType(classOf[Object]), - 1 -> UnknownValue()) - - // does not compile: - Map( - 0 -> KnownType(classOf[Object]), - 1 -> UnknownValue()) - - // Experiment.scala:10: error: type mismatch; - // found : (Int, KnownType) - // required: (Int, Product with Value{def getType: Option[java.lang.Class[_$$2]]}) where type _$$2 - // 0 -> KnownType(classOf[Object]), - // ^ - // one error found -} -sealed trait Value { - def getType: Option[Class[_]] -} - -case class UnknownValue() extends Value { - def getType = None - // compiles if changed to: - // def getType: Option[Class[_]] = None -} - -case class KnownType(typ: Class[_]) extends Value { - def getType = Some(typ) -} diff --git a/tests/untried/pos/t210.scala b/tests/untried/pos/t210.scala deleted file mode 100644 index f0b907aa5..000000000 --- a/tests/untried/pos/t210.scala +++ /dev/null @@ -1,17 +0,0 @@ -trait Lang1 { - trait Exp; - trait Visitor { def f(left: Exp): Unit } - class Eval1 extends Visitor { self: Visitor => - def f(left: Exp) = () - } -} - -trait Lang2 extends Lang1 { - class Eval2 extends Eval1 { self: Visitor => } -} -/* -object Main with App { - val lang2 = new Lang2 {} - val eval = new lang2.Eval2 -} -*/ diff --git a/tests/untried/pos/t211.scala b/tests/untried/pos/t211.scala deleted file mode 100644 index d51c9706d..000000000 --- a/tests/untried/pos/t211.scala +++ /dev/null @@ -1,8 +0,0 @@ -trait A; -trait B; -class Foo extends A with B { self: A with B => } -object Test extends App { - new Foo(); - Console.println("t211 completed"); -} - diff --git a/tests/untried/pos/t2119.scala b/tests/untried/pos/t2119.scala deleted file mode 100644 index b9cb4d9c6..000000000 --- a/tests/untried/pos/t2119.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - val orig = new java.util.ArrayList[String] - val copy = new java.util.ArrayList(orig) -} diff --git a/tests/untried/pos/t2127.scala b/tests/untried/pos/t2127.scala deleted file mode 100644 index 88cc9e708..000000000 --- a/tests/untried/pos/t2127.scala +++ /dev/null @@ -1,5 +0,0 @@ -class Foo private (val value : Int) - -abstract class Bar(val ctor : (Int) => Foo) - -object Foo extends Bar(new Foo(_)) //<--- ILLEGAL ACCESS diff --git a/tests/untried/pos/t2130-1.scala b/tests/untried/pos/t2130-1.scala deleted file mode 100644 index 8dd61c4d3..000000000 --- a/tests/untried/pos/t2130-1.scala +++ /dev/null @@ -1,5 +0,0 @@ -package foo - -package object bar { - case class Bippy(x: Int) { } -} diff --git a/tests/untried/pos/t2130-2.scala b/tests/untried/pos/t2130-2.scala deleted file mode 100644 index 1d0b33c3e..000000000 --- a/tests/untried/pos/t2130-2.scala +++ /dev/null @@ -1,17 +0,0 @@ -package foo - -package object bar { - class Bippy(x: Int) { - class Ding - object Ding - case class Dong(x: Float) - } - object Bippy { - class Dingus - object Dingus - case class Dongus(x: Float) - - def apply(xs: Int*) = new Bippy(xs.sum) - def apply() = new Bippy(5) - } -} diff --git a/tests/untried/pos/t2133.scala b/tests/untried/pos/t2133.scala deleted file mode 100644 index c74d0a4bb..000000000 --- a/tests/untried/pos/t2133.scala +++ /dev/null @@ -1,18 +0,0 @@ -trait Foo { - object bar { - private[this] def fn() = 5 - } -} - -trait Foo2 { - object bip { - def fn() = 10 - } -} - -class Bob extends AnyRef with Foo with Foo2 { - import bip._ - import bar._ - - def go() = fn() -} diff --git a/tests/untried/pos/t2168.scala b/tests/untried/pos/t2168.scala deleted file mode 100644 index 21afb239a..000000000 --- a/tests/untried/pos/t2168.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo1(x: AnyRef) = x match { case x: Function0[_] => x() } - def foo2(x: AnyRef) = x match { case x: Function0[Any] => x() } -} diff --git a/tests/untried/pos/t2171.flags b/tests/untried/pos/t2171.flags deleted file mode 100644 index eb4d19bcb..000000000 --- a/tests/untried/pos/t2171.flags +++ /dev/null @@ -1 +0,0 @@ --optimise
\ No newline at end of file diff --git a/tests/untried/pos/t2171.scala b/tests/untried/pos/t2171.scala deleted file mode 100644 index 6c754c76a..000000000 --- a/tests/untried/pos/t2171.scala +++ /dev/null @@ -1,7 +0,0 @@ -final object test { - def logIgnoredException(msg: => String) = - try 0 catch { case ex => println(msg) } - - def main (args: Array[String]): Unit = - while (true) logIgnoredException ("...") -} diff --git a/tests/untried/pos/t2179.scala b/tests/untried/pos/t2179.scala deleted file mode 100755 index 89e22b6e2..000000000 --- a/tests/untried/pos/t2179.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - (Nil:List[List[Double]]).reduceLeft((_: Any, _: Any) => Nil.indices.map(_ => 0d)) -} diff --git a/tests/untried/pos/t2183.scala b/tests/untried/pos/t2183.scala deleted file mode 100644 index 1243568b6..000000000 --- a/tests/untried/pos/t2183.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.collection.mutable._ - -object Test { - val m = new HashSet[String] with SynchronizedSet[String] -} diff --git a/tests/untried/pos/t2187-2.scala b/tests/untried/pos/t2187-2.scala deleted file mode 100644 index 506cc496f..000000000 --- a/tests/untried/pos/t2187-2.scala +++ /dev/null @@ -1,7 +0,0 @@ -class Test { - def test[A](list: List[A]) = list match { - case Seq(x, y) => "xy" - case Seq(x) => "x" - case _ => "something else" - } -} diff --git a/tests/untried/pos/t2187.scala b/tests/untried/pos/t2187.scala deleted file mode 100644 index 8a3353154..000000000 --- a/tests/untried/pos/t2187.scala +++ /dev/null @@ -1,7 +0,0 @@ -// bug #2187 -object Test extends App { - def foo(xs:List[String]) = xs match { - case Seq(x) => x - case Seq(x,y) => "" - } -} diff --git a/tests/untried/pos/t2194.scala b/tests/untried/pos/t2194.scala deleted file mode 100644 index e87be509d..000000000 --- a/tests/untried/pos/t2194.scala +++ /dev/null @@ -1,8 +0,0 @@ -// tricky to do differently? -class C - -object Test { - def f = { object o extends C; o} - val y: C = f - val x = f -} |