summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala6
-rwxr-xr-xtest/files/pos/t2635.scala16
2 files changed, 20 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 195219b9a3..78bfdaf446 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -3287,8 +3287,10 @@ A type's typeSymbol should never be inspected directly.
class SubstWildcardMap(from: List[Symbol]) extends TypeMap {
def apply(tp: Type): Type = try {
tp match {
- case TypeRef(_, sym, _) if (from contains sym) => WildcardType
- case _ => mapOver(tp)
+ case TypeRef(_, sym, _) if (from contains sym) =>
+ BoundedWildcardType(sym.info.bounds)
+ case _ =>
+ mapOver(tp)
}
} catch {
case ex: MalformedType =>
diff --git a/test/files/pos/t2635.scala b/test/files/pos/t2635.scala
new file mode 100755
index 0000000000..7cd5531356
--- /dev/null
+++ b/test/files/pos/t2635.scala
@@ -0,0 +1,16 @@
+abstract class Base
+
+object Test
+{
+ def run(c: Class[_ <: Base]): Unit = {
+ }
+
+ def main(args: Array[String]): Unit =
+ {
+ val sc: Option[Class[_ <: Base]] = Some(classOf[Base])
+ sc match {
+ case Some(c) => run(c)
+ case None =>
+ }
+ }
+}