diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-13 17:03:36 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-05-30 14:34:33 +0200 |
commit | ed1d5f310951715d95873c56f64195ac3ee45817 (patch) | |
tree | 755803d8e6badeac510de960b63ecec8fd2d6916 /tests/new | |
parent | 7bc5cd18ee4f881f223e9a317e6c6a329942d5af (diff) | |
download | dotty-ed1d5f310951715d95873c56f64195ac3ee45817.tar.gz dotty-ed1d5f310951715d95873c56f64195ac3ee45817.tar.bz2 dotty-ed1d5f310951715d95873c56f64195ac3ee45817.zip |
Fix of pos/t2454
"_" type paraeters need to be given fresh names.
Diffstat (limited to 'tests/new')
-rw-r--r-- | tests/new/t2405.scala | 23 | ||||
-rw-r--r-- | tests/new/t2421.scala | 14 | ||||
-rw-r--r-- | tests/new/t2421_delitedsl.scala | 39 | ||||
-rw-r--r-- | tests/new/t2421b_pos.scala | 19 | ||||
-rw-r--r-- | tests/new/t2421c.scala | 17 | ||||
-rwxr-xr-x | tests/new/t2425.scala | 15 | ||||
-rw-r--r-- | tests/new/t2435.scala | 27 | ||||
-rw-r--r-- | tests/new/t2441pos.scala | 8 | ||||
-rw-r--r-- | tests/new/t2444.scala | 15 | ||||
-rw-r--r-- | tests/new/t245.scala | 18 | ||||
-rw-r--r-- | tests/new/t247.scala | 26 | ||||
-rwxr-xr-x | tests/new/t2484.scala | 19 | ||||
-rw-r--r-- | tests/new/t2486.scala | 3 |
13 files changed, 0 insertions, 243 deletions
diff --git a/tests/new/t2405.scala b/tests/new/t2405.scala deleted file mode 100644 index 224b2ce83..000000000 --- a/tests/new/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/new/t2421.scala b/tests/new/t2421.scala deleted file mode 100644 index 2544a1cb3..000000000 --- a/tests/new/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/new/t2421_delitedsl.scala b/tests/new/t2421_delitedsl.scala deleted file mode 100644 index 554702a03..000000000 --- a/tests/new/t2421_delitedsl.scala +++ /dev/null @@ -1,39 +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((x: Int) => DeliteInt(x)) - - 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/new/t2421b_pos.scala b/tests/new/t2421b_pos.scala deleted file mode 100644 index 679b8a8d6..000000000 --- a/tests/new/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/new/t2421c.scala b/tests/new/t2421c.scala deleted file mode 100644 index bd24cacd7..000000000 --- a/tests/new/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/new/t2425.scala b/tests/new/t2425.scala deleted file mode 100755 index 477d5467a..000000000 --- a/tests/new/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/new/t2435.scala b/tests/new/t2435.scala deleted file mode 100644 index 697e9e1f2..000000000 --- a/tests/new/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/new/t2441pos.scala b/tests/new/t2441pos.scala deleted file mode 100644 index 25eb2232c..000000000 --- a/tests/new/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/new/t2444.scala b/tests/new/t2444.scala deleted file mode 100644 index fac1e95d0..000000000 --- a/tests/new/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/new/t245.scala b/tests/new/t245.scala deleted file mode 100644 index 570ac4178..000000000 --- a/tests/new/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/new/t247.scala b/tests/new/t247.scala deleted file mode 100644 index fdcafeb2c..000000000 --- a/tests/new/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/new/t2484.scala b/tests/new/t2484.scala deleted file mode 100755 index 15165c247..000000000 --- a/tests/new/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/new/t2486.scala b/tests/new/t2486.scala deleted file mode 100644 index 69fe4c127..000000000 --- a/tests/new/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 => () } } |