diff options
author | Martin Odersky <odersky@gmail.com> | 2015-07-20 18:12:04 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-09-18 18:12:16 +0200 |
commit | 4aa1d5e1d9e4edfc1df6161504861840b24687ae (patch) | |
tree | 2bb6a57e65a8f69d490a52a7c2b80cc649afb294 /src/dotty/tools/dotc/core/TypeApplications.scala | |
parent | ab6e5cebebe8c59901413f89281073d6eec7f8e1 (diff) | |
download | dotty-4aa1d5e1d9e4edfc1df6161504861840b24687ae.tar.gz dotty-4aa1d5e1d9e4edfc1df6161504861840b24687ae.tar.bz2 dotty-4aa1d5e1d9e4edfc1df6161504861840b24687ae.zip |
Fix problem in typeParams
Accidentally forwarded to rawTypeParams. This solved the problem with mismatching
type params in appliedTo that was caught in testLifted.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 18256b9e4..062867353 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -60,7 +60,7 @@ class TypeApplications(val self: Type) extends AnyVal { case tp: TypeRef => val tsym = tp.typeSymbol if (tsym.isClass) tsym.typeParams - else if (tsym.isAliasType) tp.underlying.rawTypeParams + else if (tsym.isAliasType) tp.underlying.typeParams else { val lam = LambdaClass(forcing = false) if (lam.exists) lam.typeParams else Nil @@ -525,12 +525,12 @@ class TypeApplications(val self: Type) extends AnyVal { } } - /** Test whether this type has a base type of the form `B[T1, ..., Bn]` where + /** Test whether this type has a base type of the form `B[T1, ..., Tn]` where * the type parameters of `B` match one-by-one the variances of `tparams`, * and where the lambda abstracted type * - * LambdaXYZ { type Apply = B[$hkArg$0, ..., $hkArg$n] } - * { type $hkArg$0 = T1; ...; type $hkArg$n = Tn } + * LambdaXYZ { type Apply = B[$hkArg$0, ..., $hkArg${n-1}] } + * { type $hkArg$0 = T1; ...; type $hkArg${n-1} = Tn } * * satisfies predicate `p`. Try base types in the order of their occurrence in `baseClasses`. * A type parameter matches a variance V if it has V as its variance or if V == 0. @@ -560,13 +560,8 @@ class TypeApplications(val self: Type) extends AnyVal { case nil => false } - try { // temporary, to avoid type mismatches in applications. Should come back to this - // when subtyping is rewritten to account for new hk-scheme. - if (tparams.isEmpty) false - else if (typeParams.nonEmpty) p(EtaExpand) || classBounds.nonEmpty && tryLift(self.baseClasses) - else classBounds.nonEmpty && tryLift(self.baseClasses) - } catch { - case ex: NoSuchElementException => false - } + tparams.nonEmpty && + (typeParams.nonEmpty && p(EtaExpand) || + classBounds.nonEmpty && tryLift(self.baseClasses)) } } |