diff options
author | Seth Tisue <seth@tisue.net> | 2017-02-16 14:09:29 -0800 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2017-02-16 14:09:29 -0800 |
commit | 3e99598973ceaa1c4afe00b0d3c3a17c57da8fea (patch) | |
tree | e21072b5781ba8eaaac116b4cb51bb84cc9f948c /src | |
parent | 2324405ca0087604f8c3f3ad78d7488cf8d7ea49 (diff) | |
parent | 36967321c7a8a99cab2f9f1c4c0c46f09d3d34a6 (diff) | |
download | scala-3e99598973ceaa1c4afe00b0d3c3a17c57da8fea.tar.gz scala-3e99598973ceaa1c4afe00b0d3c3a17c57da8fea.tar.bz2 scala-3e99598973ceaa1c4afe00b0d3c3a17c57da8fea.zip |
Merge commit '36967321c7' into merge-2.11.x-to-2.12.x-20170214
Diffstat (limited to 'src')
4 files changed, 12 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 1a4671e15f..9129478b41 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -663,10 +663,9 @@ abstract class ClassfileParser { // so have to check unsafeTypeParams.isEmpty before worrying about raw type case below, // or we'll create a boatload of needless existentials. else if (classSym.isMonomorphicType || classSym.unsafeTypeParams.isEmpty) tp - else debuglogResult(s"raw type from $classSym"){ + else debuglogResult(s"raw type from $classSym") { // raw type - existentially quantify all type parameters - val eparams = typeParamsToExistentials(classSym, classSym.unsafeTypeParams) - newExistentialType(eparams, typeRef(pre, classSym, eparams.map(_.tpeHK))) + classExistentialType(pre, classSym) } case tp => assert(sig.charAt(index) != '<', s"sig=$sig, index=$index, tp=$tp") diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index 6d883aee3d..7943187f35 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -130,8 +130,9 @@ trait SyntheticMethods extends ast.TreeDSL { */ def canEqualMethod: Tree = { syntheticCanEqual = true - createMethod(nme.canEqual_, List(AnyTpe), BooleanTpe)(m => - Ident(m.firstParam) IS_OBJ classExistentialType(clazz)) + createMethod(nme.canEqual_, List(AnyTpe), BooleanTpe) { m => + Ident(m.firstParam) IS_OBJ classExistentialType(context.prefix, clazz) + } } /* that match { case _: this.C => true ; case _ => false } diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 19460af27f..9515309802 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -667,8 +667,8 @@ trait Definitions extends api.StandardDefinitions { isBundle && isBlackbox } - def isListType(tp: Type) = tp <:< classExistentialType(ListClass) - def isIterableType(tp: Type) = tp <:< classExistentialType(IterableClass) + def isListType(tp: Type) = tp.typeSymbol.isNonBottomSubClass(ListClass) + def isIterableType(tp: Type) = tp.typeSymbol.isNonBottomSubClass(IterableClass) // These "direct" calls perform no dealiasing. They are most needed when // printing types when one wants to preserve the true nature of the type. @@ -980,14 +980,10 @@ trait Definitions extends api.StandardDefinitions { * * C[E1, ..., En] forSome { E1 >: LB1 <: UB1 ... en >: LBn <: UBn }. */ - // TODO Review the way this is used. I see two potential problems: - // 1. `existentialAbstraction` here doesn't create fresh existential type symbols, it just - // uses the class type parameter symbols directly as the list of quantified symbols. - // See SI-8244 for the trouble that this can cause. - // Compare with callers of `typeParamsToExistentials` (used in Java raw type handling) - // 2. Why don't we require a prefix? Could its omission lead to wrong results in CheckabilityChecker? - def classExistentialType(clazz: Symbol): Type = - existentialAbstraction(clazz.typeParams, clazz.tpe_*) + def classExistentialType(prefix: Type, clazz: Symbol): Type = { + val eparams = typeParamsToExistentials(clazz, clazz.unsafeTypeParams) + newExistentialType(eparams, typeRef(prefix, clazz, eparams.map(_.tpeHK))) + } // members of class scala.Any diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index ad7e3ffe8f..a6b6b1356c 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -3944,7 +3944,7 @@ trait Types * any corresponding non-variant type arguments of bt1 and bt2 are the same */ def isPopulated(tp1: Type, tp2: Type): Boolean = { - def isConsistent(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match { + def isConsistent(tp1: Type, tp2: Type): Boolean = (tp1.dealias, tp2.dealias) match { case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) => assert(sym1 == sym2, (sym1, sym2)) ( pre1 =:= pre2 |