diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-03-12 22:45:13 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-02 23:37:08 +0200 |
commit | d7545ec36bde6a21e5f3edb1b5982e801a53f6a9 (patch) | |
tree | 7a2ed83b8959055b8ccba1b474233ee3a90f9c30 /src/reflect | |
parent | 3ac185b6168a8f526446dacafd883ca5a1cf7a44 (diff) | |
download | scala-d7545ec36bde6a21e5f3edb1b5982e801a53f6a9.tar.gz scala-d7545ec36bde6a21e5f3edb1b5982e801a53f6a9.tar.bz2 scala-d7545ec36bde6a21e5f3edb1b5982e801a53f6a9.zip |
Simplify interplay between Uncurry Info- and Tree-Transformers
Now, the InfoTransformer is responsible for erasing the
path dependent types of formal parameters, at the same
place where it flattens nested method types.
This is preferable to having the tree transformer overwrite
the result of the info transformer, as used to be the case
after my previous work on SI-6135 / 493197fc.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/transform/UnCurry.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/transform/UnCurry.scala b/src/reflect/scala/reflect/internal/transform/UnCurry.scala index 6dc6a0f7b8..00c7c3de9a 100644 --- a/src/reflect/scala/reflect/internal/transform/UnCurry.scala +++ b/src/reflect/scala/reflect/internal/transform/UnCurry.scala @@ -17,7 +17,14 @@ trait UnCurry { val tp = expandAlias(tp0) tp match { case MethodType(params, MethodType(params1, restpe)) => - apply(MethodType(params ::: params1, restpe)) + // This transformation is described in UnCurryTransformer.dependentParamTypeErasure + val packSymbolsMap = new TypeMap { + // Wrapping in a TypeMap to reuse the code that opts for a fast path if the function is an identity. + def apply(tp: Type): Type = packSymbols(params, tp) + } + val existentiallyAbstractedParam1s = packSymbolsMap.mapOver(params1) + val substitutedResult = restpe.substSym(params1, existentiallyAbstractedParam1s) + apply(MethodType(params ::: existentiallyAbstractedParam1s, substitutedResult)) case MethodType(params, ExistentialType(tparams, restpe @ MethodType(_, _))) => abort("unexpected curried method types with intervening existential") case MethodType(h :: t, restpe) if h.isImplicit => @@ -60,4 +67,4 @@ trait UnCurry { */ def transformInfo(sym: Symbol, tp: Type): Type = if (sym.isType) uncurryType(tp) else uncurry(tp) -}
\ No newline at end of file +} |