summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-05-31 03:55:46 -0700
committerPaul Phillips <paulp@improving.org>2013-05-31 04:34:31 -0700
commit3c21aa38731b5011d09207e106918e16ded8ff98 (patch)
treeb747e33cebf671af969c8c0ea77334cc16414e3d /src/reflect
parentbcd052c029129129c2364327e79c4d66eb6193ee (diff)
downloadscala-3c21aa38731b5011d09207e106918e16ded8ff98.tar.gz
scala-3c21aa38731b5011d09207e106918e16ded8ff98.tar.bz2
scala-3c21aa38731b5011d09207e106918e16ded8ff98.zip
SI-7520 bug in subtyping.
isSubType, if given two SingleTypes, would check =:= and stop there. It is necessary to continue with weakening the left hand side, because (for instance) the singleton type on the left hand side could be a refinement class carrying parents which are themselves single or constant types.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/tpe/TypeComparers.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala
index 68844a29b0..63f17dff34 100644
--- a/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala
+++ b/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala
@@ -358,8 +358,10 @@ trait TypeComparers {
/** Does type `tp1` conform to `tp2`? */
private def isSubType2(tp1: Type, tp2: Type, depth: Int): Boolean = {
+ def retry(lhs: Type, rhs: Type) = ((lhs ne tp1) || (rhs ne tp2)) && isSubType(lhs, rhs, depth)
+
if (isSingleType(tp1) && isSingleType(tp2) || isConstantType(tp1) && isConstantType(tp2))
- return (tp1 =:= tp2)
+ return (tp1 =:= tp2) || retry(tp1.underlying, tp2)
if (tp1.isHigherKinded || tp2.isHigherKinded)
return isHKSubType(tp1, tp2, depth)