diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-10 10:00:54 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-03-10 21:04:19 -0700 |
commit | 2fa2db784075dfb58cf507c45a948819ade8a6d4 (patch) | |
tree | 0e32232e8fa2ed376a51cd83efa12772c55c3721 /src/reflect | |
parent | 1b6297f642877dcc7edcd704a5d3cf99a12e54b8 (diff) | |
download | scala-2fa2db784075dfb58cf507c45a948819ade8a6d4.tar.gz scala-2fa2db784075dfb58cf507c45a948819ade8a6d4.tar.bz2 scala-2fa2db784075dfb58cf507c45a948819ade8a6d4.zip |
SI-7228, bug in weak subtyping.
Another in the category of bugs which involve narrowing,
widening, mediuming, dealiasing, weakening, normalizing,
denormalizing, supernormalizing, subnormalizing, and
double-bounded supersubnormalizing.
This is probably not the ideal fix, but it is an improvement.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Types.scala | 4 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/tpe/TypeComparers.scala | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index a6c5367425..b59732e595 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -1217,7 +1217,7 @@ trait Types protected def rewrap(newtp: Type): Type = NotNullType(newtp) override def isNotNull: Boolean = true override def notNull = this - override def deconst: Type = underlying //todo: needed? + override def deconst: Type = underlying.deconst //todo: needed? override def safeToString: String = underlying.toString + " with NotNull" override def kind = "NotNullType" } @@ -1989,7 +1989,7 @@ trait Types assert(underlying.typeSymbol != UnitClass) override def isTrivial: Boolean = true override def isNotNull = value.value != null - override def deconst: Type = underlying + override def deconst: Type = underlying.deconst override def safeToString: String = underlying.toString + "(" + value.escapedStringValue + ")" override def kind = "ConstantType" diff --git a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala index 82321f61c2..2d499cf299 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala @@ -583,7 +583,7 @@ trait TypeComparers { def isWeakSubType(tp1: Type, tp2: Type) = - tp1.deconst.normalize match { + tp1.widen.normalize match { case TypeRef(_, sym1, _) if isNumericValueClass(sym1) => tp2.deconst.normalize match { case TypeRef(_, sym2, _) if isNumericValueClass(sym2) => @@ -609,8 +609,8 @@ trait TypeComparers { * (Even if the calls are to typeSymbolDirect.) */ def isNumericSubType(tp1: Type, tp2: Type): Boolean = ( - isNumericValueType(tp1) - && isNumericValueType(tp2) + isNumericValueType(tp1.dealiasWiden) + && isNumericValueType(tp2.dealias) && isNumericSubClass(tp1.typeSymbol, tp2.typeSymbol) ) |