diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-22 03:42:47 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-22 03:42:47 +0000 |
commit | f826618f7b6dda6f03fd1a695d9600386021c8c3 (patch) | |
tree | c88b9836e5171b05a7183171d019dce5d38bdff1 /src | |
parent | 1050387558c4d16dd7427916e59b4824c4f70063 (diff) | |
download | scala-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')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 13 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index fa410a2afd..b1ea837cf6 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -235,6 +235,7 @@ trait Definitions extends reflect.generic.StandardDefinitions { lazy val TraversableClass = getClass("scala.collection.Traversable") lazy val ListModule = getModule("scala.collection.immutable.List") + def List_apply = getMember(ListModule, nme.apply) lazy val NilModule = getModule("scala.collection.immutable.Nil") lazy val SeqModule = getModule("scala.collection.Seq") 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) |