summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-22 03:42:47 +0000
committerPaul Phillips <paulp@improving.org>2010-12-22 03:42:47 +0000
commitf826618f7b6dda6f03fd1a695d9600386021c8c3 (patch)
treec88b9836e5171b05a7183171d019dce5d38bdff1 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent1050387558c4d16dd7427916e59b4824c4f70063 (diff)
downloadscala-f826618f7b6dda6f03fd1a695d9600386021c8c3.tar.gz
scala-f826618f7b6dda6f03fd1a695d9600386021c8c3.tar.bz2
scala-f826618f7b6dda6f03fd1a695d9600386021c8c3.zip
This fixes a regression incurred in r23565 whic...
This fixes a regression incurred in r23565 which was creating at least tens of megabytes of garbage on each build. There is a whole bunch to say about this one, but first the commit. Review by odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 5523aba07e..73bf39bfe3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2466,11 +2466,14 @@ trait Typers { self: Analyzer =>
}
}
- if (fun.hasSymbol && fun.symbol.name == nme.apply &&
- fun.symbol.owner == ListClass && args.isEmpty && !onlyPresentation)
- atPos(tree.pos) { gen.mkNil setType restpe }
+ /** This is translating uses of List() into Nil. This is less
+ * than ideal from a consistency standpoint, but it shouldn't be
+ * altered without due caution.
+ */
+ if (fun.symbol == List_apply && args.isEmpty && !onlyPresentation)
+ atPos(tree.pos)(gen.mkNil setType restpe)
else
- constfold(treeCopy.Apply(tree, fun, args1).setType(ifPatternSkipFormals(restpe)))
+ constfold(treeCopy.Apply(tree, fun, args1) setType ifPatternSkipFormals(restpe))
} else if (needsInstantiation(tparams, formals, args)) {
//println("needs inst "+fun+" "+tparams+"/"+(tparams map (_.info)))
@@ -2488,10 +2491,8 @@ trait Typers { self: Analyzer =>
if (isByNameParamType(remainingParams.head)) POLYmode
else POLYmode | BYVALmode
if (remainingParams.tail.nonEmpty) remainingParams = remainingParams.tail
- // println("typedArgToPoly(arg, formal): "+(arg, formal))
val arg1 = typedArg(arg, argMode(fun, mode), newmode, lenientPt)
val argtparams = context.extractUndetparams()
- // println("typedArgToPoly(arg1, argtparams): "+(arg1, argtparams))
if (!argtparams.isEmpty) {
val strictPt = formal.instantiateTypeParams(tparams, strictTargs)
inferArgumentInstance(arg1, argtparams, strictPt, lenientPt)