diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-27 11:15:39 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-27 11:15:39 -0700 |
commit | e42991f40707023d563f43bf66f3d8b9a637aa1b (patch) | |
tree | 11d7ce5705bc9050f6ee63f0c69e7a5150bbf715 | |
parent | d844befe92c9851dc00b9fd677532390b0aade1a (diff) | |
parent | de249bab42c36b2ce2f5af478a98ce411ab5c9b3 (diff) | |
download | scala-e42991f40707023d563f43bf66f3d8b9a637aa1b.tar.gz scala-e42991f40707023d563f43bf66f3d8b9a637aa1b.tar.bz2 scala-e42991f40707023d563f43bf66f3d8b9a637aa1b.zip |
Merge pull request #2598 from paulp/pr/raw-type-stubs
Print raw types correctly.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 6 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 6 | ||||
-rw-r--r-- | test/files/neg/raw-types-stubs.check | 11 | ||||
-rw-r--r-- | test/files/neg/raw-types-stubs/M_1.java | 3 | ||||
-rw-r--r-- | test/files/neg/raw-types-stubs/Raw_2.java | 4 | ||||
-rw-r--r-- | test/files/neg/raw-types-stubs/S_3.scala | 1 |
7 files changed, 30 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index a6a3a4911f..5622f67459 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -273,7 +273,8 @@ trait Implicits { /** An extractor for types of the form ? { name: (? >: argtpe <: Any*)restp } */ object HasMethodMatching { - val dummyMethod = NoSymbol.newTermSymbol(newTermName("typer$dummy")) + val dummyMethod = NoSymbol.newTermSymbol("typer$dummy") setInfo NullaryMethodType(AnyTpe) + def templateArgType(argtpe: Type) = new BoundedWildcardType(TypeBounds.lower(argtpe)) def apply(name: Name, argtpes: List[Type], restpe: Type): Type = { diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 407eb3ac18..4ccfb31878 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -604,8 +604,10 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans def stubImplementations: List[String] = { // Grouping missing methods by the declaring class val regrouped = missingMethods.groupBy(_.owner).toList - def membersStrings(members: List[Symbol]) = - members.sortBy("" + _.name) map (m => m.defStringSeenAs(clazz.tpe memberType m) + " = ???") + def membersStrings(members: List[Symbol]) = { + members foreach fullyInitializeSymbol + members.sortBy(_.name) map (m => m.defStringSeenAs(clazz.tpe_* memberType m) + " = ???") + } if (regrouped.tail.isEmpty) membersStrings(regrouped.head._2) diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 040ea5fa4e..5cd86b7eed 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -207,13 +207,17 @@ trait Definitions extends api.StandardDefinitions { */ def fullyInitializeSymbol(sym: Symbol): Symbol = { sym.initialize + // Watch out for those darn raw types on method parameters + if (sym.owner.initialize.isJavaDefined) + sym.cookJavaRawInfo() + fullyInitializeType(sym.info) fullyInitializeType(sym.tpe_*) sym } def fullyInitializeType(tp: Type): Type = { tp.typeParams foreach fullyInitializeSymbol - tp.paramss.flatten foreach fullyInitializeSymbol + mforeach(tp.paramss)(fullyInitializeSymbol) tp } def fullyInitializeScope(scope: Scope): Scope = { diff --git a/test/files/neg/raw-types-stubs.check b/test/files/neg/raw-types-stubs.check new file mode 100644 index 0000000000..f1b26a23b7 --- /dev/null +++ b/test/files/neg/raw-types-stubs.check @@ -0,0 +1,11 @@ +S_3.scala:1: error: class Sub needs to be abstract, since: +it has 2 unimplemented members. +/** As seen from class Sub, the missing signatures are as follows. + * For convenience, these are usable as stub implementations. + */ + def raw(x$1: M_1[_ <: String]): Unit = ??? + def raw(x$1: Any): Unit = ??? + +class Sub extends Raw_2 { } + ^ +one error found diff --git a/test/files/neg/raw-types-stubs/M_1.java b/test/files/neg/raw-types-stubs/M_1.java new file mode 100644 index 0000000000..6ea0d2e593 --- /dev/null +++ b/test/files/neg/raw-types-stubs/M_1.java @@ -0,0 +1,3 @@ +public class M_1<K extends String> { } + + diff --git a/test/files/neg/raw-types-stubs/Raw_2.java b/test/files/neg/raw-types-stubs/Raw_2.java new file mode 100644 index 0000000000..eff7df790e --- /dev/null +++ b/test/files/neg/raw-types-stubs/Raw_2.java @@ -0,0 +1,4 @@ +public abstract class Raw_2 { + public abstract void raw(Object list); + public abstract void raw(M_1 list); +} diff --git a/test/files/neg/raw-types-stubs/S_3.scala b/test/files/neg/raw-types-stubs/S_3.scala new file mode 100644 index 0000000000..618eedc888 --- /dev/null +++ b/test/files/neg/raw-types-stubs/S_3.scala @@ -0,0 +1 @@ +class Sub extends Raw_2 { } |