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 | |
parent | bf02e46f2ae1fde75f28da909b8a6e23383cec9b (diff) | |
download | scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.tar.gz scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.tar.bz2 scala-5d61522281b785ba53c34fe38fe6e1ce59bcfac9.zip |
Fixed #2444
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | test/files/pos/t1756.scala (renamed from test/pending/pos/t1756.scala) | 0 | ||||
-rw-r--r-- | test/files/pos/t2444.scala | 15 | ||||
-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 |
10 files changed, 27 insertions, 78 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 6b3d24ffa2..1c6c04b2bc 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2329,11 +2329,20 @@ A type's typeSymbol should never be inspected directly. tp1 } } + override def mapOver(tp: Type): Type = tp match { + case SingleType(pre, sym) => + if (sym.isPackageClass) tp // short path + else { + val pre1 = this(pre) + if ((pre1 eq pre) || !pre1.isStable) tp + else singleType(pre1, sym) + } + case _ => super.mapOver(tp) + } + override def mapOver(tree: Tree) = tree match { - case tree:Ident - if tree.tpe.isStable - => + case tree:Ident if tree.tpe.isStable => // Do not discard the types of existential ident's. // The symbol of the Ident itself cannot be listed // in the existential's parameters, so the @@ -2343,9 +2352,6 @@ A type's typeSymbol should never be inspected directly. case _ => super.mapOver(tree) } - - - } val tpe1 = extrapolate(tpe) var tparams0 = tparams diff --git a/test/pending/pos/t1756.scala b/test/files/pos/t1756.scala index 4f7202114c..4f7202114c 100644..100755 --- a/test/pending/pos/t1756.scala +++ b/test/files/pos/t1756.scala diff --git a/test/files/pos/t2444.scala b/test/files/pos/t2444.scala new file mode 100644 index 0000000000..6f07dcf92d --- /dev/null +++ b/test/files/pos/t2444.scala @@ -0,0 +1,15 @@ +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/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") |