aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-29 19:41:36 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:01 +0200
commit6a7e466fa2ff5d6d01a25bed0c685188c9a84a63 (patch)
tree332b0156ebe12c76ec2eafd1529f969442736262 /src/dotty/tools/dotc/core/Types.scala
parente36a36a5aea93c19aa133ffb215bc05787378375 (diff)
downloaddotty-6a7e466fa2ff5d6d01a25bed0c685188c9a84a63.tar.gz
dotty-6a7e466fa2ff5d6d01a25bed0c685188c9a84a63.tar.bz2
dotty-6a7e466fa2ff5d6d01a25bed0c685188c9a84a63.zip
Avoid accidental creation of hk types
- Swap subtype tests Previous order could create constraints where hk type parameters got a * bound. (this is now caught in an assert). - Make underlyingClassRef work for hk types under new scheme. - Ensure that toAvoid does not creat hk from * types - Let getClass return a * type We will be pickier than before. An unapplied type such as `java.lang.Class` will always be an hk type. Hence, the type of getClass has to be appleid to [_] to make it a * type.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 2fa4f94c1..ab5c795e3 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -875,13 +875,16 @@ object Types {
if (tp.symbol.isClass) tp
else if (tp.symbol.isAliasType) tp.underlying.underlyingClassRef(refinementOK)
else NoType
- case tp: AnnotatedType => tp.underlying.underlyingClassRef(refinementOK)
+ case tp: AnnotatedType =>
+ tp.underlying.underlyingClassRef(refinementOK)
case tp: RefinedType =>
def isParamName = tp.classSymbol.typeParams.exists(_.name == tp.refinedName)
- if (refinementOK || isParamName) tp.underlying.underlyingClassRef(refinementOK)
+ if (refinementOK || tp.isTypeParam || isParamName) tp.underlying.underlyingClassRef(refinementOK)
else NoType
- case tp: RecType if refinementOK => tp.parent
- case _ => NoType
+ case tp: RecType =>
+ tp.underlying.underlyingClassRef(refinementOK)
+ case _ =>
+ NoType
}
/** The iterator of underlying types as long as type is a TypeProxy.