diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-10-08 21:52:15 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-10-08 21:52:15 +0200 |
commit | ff051e29eae9139a688664f3531028cd89df4c75 (patch) | |
tree | 259bff55d00a912c69c9536b2f64e719402ebace /src/reflect | |
parent | c038732f1b302dd128b32512aab4cf0826752599 (diff) | |
download | scala-ff051e29eae9139a688664f3531028cd89df4c75.tar.gz scala-ff051e29eae9139a688664f3531028cd89df4c75.tar.bz2 scala-ff051e29eae9139a688664f3531028cd89df4c75.zip |
SI-8894 dealias when looking at tuple components
Classic bait-and-switch: `isTupleType` dealiases, but `typeArgs` does not.
When deciding with `isTupleType`, process using `tupleComponents`.
Similar for other combos. We should really enforce this using extractors,
and only decouple when performance is actually impacted.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 57a17693ad..70375d974c 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -653,6 +653,7 @@ trait Definitions extends api.StandardDefinitions { // tends to change the course of events by forcing types. def isFunctionType(tp: Type) = isFunctionTypeDirect(tp.dealiasWiden) def isTupleType(tp: Type) = isTupleTypeDirect(tp.dealiasWiden) + def tupleComponents(tp: Type) = tp.dealiasWiden.typeArgs lazy val ProductRootClass: ClassSymbol = requiredClass[scala.Product] def Product_productArity = getMemberMethod(ProductRootClass, nme.productArity) @@ -837,7 +838,7 @@ trait Definitions extends api.StandardDefinitions { def typeOfMemberNamedApply(tp: Type) = typeArgOfBaseTypeOr(tp, SeqClass)(resultOfMatchingMethod(tp, nme.apply)(IntTpe)) def typeOfMemberNamedDrop(tp: Type) = typeArgOfBaseTypeOr(tp, SeqClass)(resultOfMatchingMethod(tp, nme.drop)(IntTpe)) def typesOfSelectors(tp: Type) = - if (isTupleType(tp)) tp.typeArgs + if (isTupleType(tp)) tupleComponents(tp) else getterMemberTypes(tp, productSelectors(tp)) // SI-8128 Still using the type argument of the base type at Seq/Option if this is an old-style (2.10 compatible) |