diff options
author | Martin Odersky <odersky@gmail.com> | 2009-10-12 10:57:15 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-10-12 10:57:15 +0000 |
commit | 5d61522281b785ba53c34fe38fe6e1ce59bcfac9 (patch) | |
tree | e0ccda2a8a7fe62ce4a2e2657dac9931d534eaec /test/pending | |
parent | bf02e46f2ae1fde75f28da909b8a6e23383cec9b (diff) | |
download | scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.tar.gz scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.tar.bz2 scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.zip |
Fixed #2444
Diffstat (limited to 'test/pending')
-rw-r--r-- | test/pending/pos/t1756.scala | 54 | ||||
-rw-r--r-- | test/pending/pos/t2081.scala | 7 | ||||
-rw-r--r-- | test/pending/pos/t2108.scala | 2 | ||||
-rw-r--r-- | test/pending/pos/t2127.scala | 32 | ||||
-rw-r--r-- | test/pending/pos/t2130.scala | 5 | ||||
-rw-r--r-- | test/pending/pos/t2178.scala | 11 | ||||
-rw-r--r-- | test/pending/pos/t2185,.scala | 4 | ||||
-rw-r--r-- | test/pending/pos/t2188.scala | 11 |
8 files changed, 0 insertions, 126 deletions
diff --git a/test/pending/pos/t1756.scala b/test/pending/pos/t1756.scala deleted file mode 100644 index 4f7202114c..0000000000 --- a/test/pending/pos/t1756.scala +++ /dev/null @@ -1,54 +0,0 @@ - -/** -This is a tricky issue which has to do with the fact that too much conflicting -type information is propagated into a single implicit search, where the intended -solution applies two implicit searches. - -Roughly, in x + x * y, the first x is first typed as Poly[A]. That -means the x * y is then typed as Poly[A]. Then the second x is typed -as Poly[A], then y is typed as Poly[Poly[A]]. The application x * y -fails, so the coef2poly implicit conversion is applied to x. That -means we look for an implicit conversion from type Poly[A] to type -?{val *(x$1: ?>: Poly[Poly[A]] <: Any): Poly[A]}. Note that the result -type Poly[A] is propagated into the implicit search. Poly[A] comes as -expected type from x+, because the lhs x is still typed as a Poly[A]. -This means that the argument of the implicit conversion is typechecked -with expected type A with Poly[A]. And no solution is found. - -To solve this, I added a fallback scheme similar to implicit arguents: -When an implicit view that adds a method matching given arguments and result -type fails, try again without the result type. -*/ -trait Ring[T <: Ring[T]] { - def +(that: T): T - def *(that: T): T -} - -class A extends Ring[A] { - def +(that: A) = new A - def *(that: A) = new A -} - -class Poly[C <: Ring[C]](val c: C) extends Ring[Poly[C]] { - def +(that: Poly[C]) = new Poly(this.c+that.c) - def *(that: Poly[C]) = new Poly(this.c*that.c) -} - -object Test extends Application { - - implicit def coef2poly[C <: Ring[C]](c: C): Poly[C] = new Poly(c) - - val a = new A - val x = new Poly(new A) - - println(x+a) // works - println(a+x) // works - - val y = new Poly(new Poly(new A)) - - println(x+y*x) // works - println(x*y+x) // works - println(y*x+x) // works - - println(x+x*y) // failed before -} diff --git a/test/pending/pos/t2081.scala b/test/pending/pos/t2081.scala deleted file mode 100644 index 72ebd0557b..0000000000 --- a/test/pending/pos/t2081.scala +++ /dev/null @@ -1,7 +0,0 @@ -class RichInt(n: Int) { - def days = 1000*60*60*24*n -} - -implicit def RichInt(n: Int): RichInt = new RichInt(n) - -10.days diff --git a/test/pending/pos/t2108.scala b/test/pending/pos/t2108.scala deleted file mode 100644 index cd73b42627..0000000000 --- a/test/pending/pos/t2108.scala +++ /dev/null @@ -1,2 +0,0 @@ -val a: Vector[_ <: Vector[Any]] = Array(Array("", 0)) -val x = a(0) // java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to scala.collection.mutable.Vector diff --git a/test/pending/pos/t2127.scala b/test/pending/pos/t2127.scala deleted file mode 100644 index e5d3550049..0000000000 --- a/test/pending/pos/t2127.scala +++ /dev/null @@ -1,32 +0,0 @@ -// won't fix. Constructor code - -// As discussed here: http://www.nabble.com/Companion-object-constructor-visibility-td24342096.html - -//Simplified example: - - class Foo private (val value : Int) - - abstract class Bar(val ctor : (Int) => Foo) - - object Foo extends Bar(new Foo(_)) { //<--- ILLEGAL ACCESS - def main(args: Array[String]){} - } - -//however the following is legal: -/* - class Foo private (val value : Int) - - abstract class Bar{ - - var ctor : (Int) => Foo - - } - - object Foo extends Bar{ - - ctor = new Foo(_) //<--- Legal access - - } - -The constructor invocation of Bar is done within the scope of object Foo's constructor, and therefor the private constructor of Foo should be visible and accessible. -*/ diff --git a/test/pending/pos/t2130.scala b/test/pending/pos/t2130.scala deleted file mode 100644 index 79aa5dd687..0000000000 --- a/test/pending/pos/t2130.scala +++ /dev/null @@ -1,5 +0,0 @@ -package object foo { - - case class X() - -} diff --git a/test/pending/pos/t2178.scala b/test/pending/pos/t2178.scala deleted file mode 100644 index 98ea119299..0000000000 --- a/test/pending/pos/t2178.scala +++ /dev/null @@ -1,11 +0,0 @@ -// fixed by now -scala> Array(Array(1)).last.last -java.lang.ClassCastException: [I - at .<init>(<console>:5) - at .<clinit>(<console>) - at RequestResult$.<init>(<console>:4) - at RequestResult$.<clinit>(<console>) - at RequestResult$result(<console>) - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) - at sun.reflect.DelegatingMethodAccessorImpl... diff --git a/test/pending/pos/t2185,.scala b/test/pending/pos/t2185,.scala deleted file mode 100644 index c0b63b34a8..0000000000 --- a/test/pending/pos/t2185,.scala +++ /dev/null @@ -1,4 +0,0 @@ -// fixed in trunk -scala> def foo { Nil.map(identity) } def foo { Nil.map(identity) } def foo { Nil.map(identity) } -<console>:4: error: could not find implicit value for parameter bf:scala.collection.generic.BuilderFactory[Nothing,Unit,List[Nothing]]. - def foo { Nil.map(identity) } diff --git a/test/pending/pos/t2188.scala b/test/pending/pos/t2188.scala deleted file mode 100644 index 3c8ee57636..0000000000 --- a/test/pending/pos/t2188.scala +++ /dev/null @@ -1,11 +0,0 @@ -// test no longer applicable. but I think the underlying problem is fixed in trunk - -scala> implicit def toJavaList[A](t:collection.Sequence[A]):java.util.List[A] = - | java.util.Arrays.asList(t.toArray:_*) java.util.Arrays.asList(t.toArray:_*) -toJavaList: [A](t: Sequence[A])java.util.List[A] - -scala> val x: java.util.List[String] = List("foo") -<console>:7: error: type mismatch; - found : List[Any] - required: java.util.List[String] - val x: java.util.List[String] = List("foo") |