diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-04-10 23:03:41 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-04-10 23:09:50 +0200 |
commit | f93e2189dd4f6bf129e70f85c03af34e1b507377 (patch) | |
tree | bb54c8b7f6287bcead1e3d02aea0316258a51223 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | b448f13d431a1a4e9d23c6acbf4bd15ccb647e3f (diff) | |
download | scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.tar.gz scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.tar.bz2 scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.zip |
Fix memory leak related to default arguments in presentation compiler.
This bug exists for a long time, but was triggered / discovered only lately
by the default argument of mkParams in 118aef558f.
This reverts the workaroud commit 19b6ad5ee4.
The fix is tested by test/files/presentation/memory-leaks which runs the
presentation compiler several times on Typers.scala. I could not reproduce
the memory leak in a smaller test case.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index f558e0afc7..c9679faa7d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2202,7 +2202,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { vparams map {p => if(p.tpt.tpe == null) typedType(p.tpt).tpe else p.tpt.tpe} } - def mkParams(methodSym: Symbol, formals: List[Type]/* = deriveFormals*/) = { + def mkParams(methodSym: Symbol, formals: List[Type] = deriveFormals) = { selOverride match { case None if targs.isEmpty => MissingParameterTypeAnonMatchError(tree, pt); (Nil, EmptyTree) case None => @@ -2228,7 +2228,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { // rig the show so we can get started typing the method body -- later we'll correct the infos... anonClass setInfo ClassInfoType(List(ObjectClass.tpe, pt, SerializableClass.tpe), newScope, anonClass) val methodSym = anonClass.newMethod(nme.apply, tree.pos, FINAL) - val (paramSyms, selector) = mkParams(methodSym, deriveFormals) + val (paramSyms, selector) = mkParams(methodSym) if (selector eq EmptyTree) EmptyTree else { @@ -2292,7 +2292,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { def isDefinedAtMethod = { val methodSym = anonClass.newMethod(nme.isDefinedAt, tree.pos, FINAL) - val (paramSyms, selector) = mkParams(methodSym, deriveFormals) + val (paramSyms, selector) = mkParams(methodSym) if (selector eq EmptyTree) EmptyTree else { val methodBodyTyper = newTyper(context.makeNewScope(context.tree, methodSym)) // should use the DefDef for the context's tree, but it doesn't exist yet (we need the typer we're creating to create it) |