diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-10 11:17:33 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-12-10 11:17:33 +0100 |
commit | 1c77b03cb9909c3a1bf4477e49e58d81b25f47b2 (patch) | |
tree | fd934cbcdd0dc27b1cab0e3045b6880993225d1d /src/dotty/tools/dotc/core/TypeApplications.scala | |
parent | 169c8dc0dd06349b50bc8c059566d5b66314a133 (diff) | |
download | dotty-1c77b03cb9909c3a1bf4477e49e58d81b25f47b2.tar.gz dotty-1c77b03cb9909c3a1bf4477e49e58d81b25f47b2.tar.bz2 dotty-1c77b03cb9909c3a1bf4477e49e58d81b25f47b2.zip |
Fix TypeLambda extractor.
As remarked by @smarter, argInfos does not work for type lambdas,
so argBoundss is always Nil.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 684e83633..dabd2f2cd 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -70,10 +70,18 @@ object TypeApplications { } def unapply(tp: Type)(implicit ctx: Context): Option[(List[Int], List[TypeBounds], Type)] = tp match { - case app @ RefinedType(prefix, tpnme.hkApply) => - val cls = prefix.typeSymbol + case app @ RefinedType(parent, tpnme.hkApply) => + val cls = parent.typeSymbol val variances = cls.typeParams.map(_.variance) - val argBounds = prefix.argInfos.map(_.bounds) + def collectBounds(t: Type, acc: List[TypeBounds]): List[TypeBounds] = t match { + case t @ RefinedType(p, rname) => + assert(rname.isHkArgName) + collectBounds(p, t.refinedInfo.bounds :: acc) + case TypeRef(_, lname) => + assert(lname.isLambdaTraitName) + acc + } + val argBounds = collectBounds(parent, Nil) Some((variances, argBounds, app.refinedInfo.argInfo)) case _ => None |