diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-02-15 12:41:23 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-15 12:41:23 +0100 |
commit | 2fb6a1e240f7892e73979150fb323cd03de637e0 (patch) | |
tree | bb6ce4a577c0d548960fdbcd52b31d49e4e8b5c1 /src/compiler | |
parent | 8801d2937c45681bd58252ce3390a80754da6d6b (diff) | |
download | scala-2fb6a1e240f7892e73979150fb323cd03de637e0.tar.gz scala-2fb6a1e240f7892e73979150fb323cd03de637e0.tar.bz2 scala-2fb6a1e240f7892e73979150fb323cd03de637e0.zip |
fixes compat for tree and type extractors
When I removed XXXDef(...) and XXXType(...) methods from the public API,
I put compatibility stubs in compat via implicit classes enriching
XXXExtractor traits with apply methods.
Unfortunately, this doesn't work, because if XXXDef or XXXType have
any kind of an apply method left in the public API, then implicit classes
won't even be considered when resolving calls to XXXDef(...) or XXXType(...).
Therefore I had to put those removed methods back and adorn them with an
implicit parameter that can only be resolved when "import compat._"
is in place. Quite extravagant, yes, but goes along the lines with the
design goals of the refactoring, which are:
1) Break source compatibility for users who are using methods that are
now moved to internal in order to attract attention.
2) Provide an easy way to fix the breakage by importing compat._, which
will pimp back all the missing APIs with deprecation warnings that are
going to guide migration.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Delambdafy.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index 818d0767b9..1468680fe0 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -130,7 +130,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre if (!thisProxy.exists) { target setFlag STATIC } - val params = ((optionSymbol(thisProxy) map {proxy:Symbol => ValDef(proxy)}) ++ (target.paramss.flatten map ValDef)).toList + val params = ((optionSymbol(thisProxy) map {proxy:Symbol => ValDef(proxy)}) ++ (target.paramss.flatten map ValDef.apply)).toList val methSym = oldClass.newMethod(unit.freshTermName(nme.accessor.toString()), target.pos, FINAL | BRIDGE | SYNTHETIC | PROTECTED | STATIC) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index fea49be900..02e55241b3 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1652,7 +1652,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case SpecialOverload(original, env) => debuglog("completing specialized " + symbol.fullName + " calling " + original) debuglog("special overload " + original + " -> " + env) - val t = DefDef(symbol, { vparamss => + val t = DefDef(symbol, { vparamss: List[List[Symbol]] => val fun = Apply(Select(This(symbol.owner), original), makeArguments(original, vparamss.head)) @@ -1750,7 +1750,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { // flag. nobody has to see this anyway :) sym.setFlag(SPECIALIZED) // create empty bodies for specializations - localTyper.typed(Block(norm.tail.map(sym => DefDef(sym, { vparamss => EmptyTree })), ddef)) + localTyper.typed(Block(norm.tail.map(sym => DefDef(sym, { vparamss: List[List[Symbol]] => EmptyTree })), ddef)) } else tree case _ => @@ -1815,7 +1815,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val newBody = symSubstituter(body(source).duplicate) tpt modifyType (_.substSym(oldtparams, newtparams)) - copyDefDef(tree)(vparamss = List(newSyms map ValDef), rhs = newBody) + copyDefDef(tree)(vparamss = List(newSyms map ValDef.apply), rhs = newBody) } /** Create trees for specialized members of 'sClass', based on the @@ -1852,9 +1852,9 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } // ctor - mbrs += DefDef(m, Modifiers(m.flags), mmap(List(vparams))(ValDef), EmptyTree) + mbrs += DefDef(m, Modifiers(m.flags), mmap(List(vparams))(ValDef.apply), EmptyTree) } else { - mbrs += DefDef(m, { paramss => EmptyTree }) + mbrs += DefDef(m, { paramss: List[List[Symbol]] => EmptyTree }) } } else if (m.isValue) { mbrs += ValDef(m).setType(NoType) |