diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-07 14:52:07 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-08 16:24:12 +0200 |
commit | 9d7f81103b423a51b021ab80884cfbc57bfb75f6 (patch) | |
tree | d9651a6fdbd821932b2c4d2e5e17a52351e50b1e /src | |
parent | d43f5ce5aa10e39ad05a385c31fc7178eba997c1 (diff) | |
download | scala-9d7f81103b423a51b021ab80884cfbc57bfb75f6.tar.gz scala-9d7f81103b423a51b021ab80884cfbc57bfb75f6.tar.bz2 scala-9d7f81103b423a51b021ab80884cfbc57bfb75f6.zip |
SI-7335 Don't import Predef._ in Predef.scala
The check for this was foiled by the introduction of
DeprecatedPredef in c26a8db0. This didn't cause any
harm, but in any case this commit restores the intended
state of affairs.
The change is visible only through logging; no test case
is included.
qbin/scalac -Ydebug -Ylog:all src/library/scala/Predef.scala -Ystop-after:typer 2>&1 | grep -i "Omitted import of Predef"
[log namer] Omitted import of Predef._ for Predef.scala
[log typer] Omitted import of Predef._ for Predef.scala
A redundant override of `firstDefinesClassOrObject` is also
removed.
Maybe we can remove the special case altogether?
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 5 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/TreeInfo.scala | 13 |
3 files changed, 10 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index 6a0f4407fc..0731d78a9b 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -87,12 +87,4 @@ abstract class TreeInfo extends scala.reflect.internal.TreeInfo { case DocDef(_, definition) => isPureDef(definition) case _ => super.isPureDef(tree) } - - /** Does list of trees start with a definition of - * a class of module with given name (ignoring imports) - */ - override def firstDefinesClassOrObject(trees: List[Tree], name: Name): Boolean = trees match { - case ClassDef(_, `name`, _, _) :: Nil => true - case _ => super.firstDefinesClassOrObject(trees, name) - } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index e89a860e0f..f135f7f6ae 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -81,7 +81,10 @@ trait Contexts { self: Analyzer => if (settings.noimports) Nil else if (unit.isJava) RootImports.javaList - else if (settings.nopredef || treeInfo.noPredefImportForUnit(unit.body)) RootImports.javaAndScalaList + else if (settings.nopredef || treeInfo.noPredefImportForUnit(unit.body)) { + debuglog("Omitted import of Predef._ for " + unit) + RootImports.javaAndScalaList + } else RootImports.completeList } diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index b1f58814c7..0ddcc9fd7b 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -667,13 +667,12 @@ abstract class TreeInfo { * a class of module with given name (ignoring imports) */ def firstDefinesClassOrObject(trees: List[Tree], name: Name): Boolean = trees match { - case Import(_, _) :: xs => firstDefinesClassOrObject(xs, name) - case Annotated(_, tree1) :: Nil => firstDefinesClassOrObject(List(tree1), name) - case ModuleDef(_, `name`, _) :: Nil => true - case ClassDef(_, `name`, _, _) :: Nil => true - case _ => false - } - + case Import(_, _) :: xs => firstDefinesClassOrObject(xs, name) + case Annotated(_, tree1) :: _ => firstDefinesClassOrObject(List(tree1), name) + case ModuleDef(_, `name`, _) :: _ => true + case ClassDef(_, `name`, _, _) :: _ => true + case _ => false + } /** Is this file the body of a compilation unit which should not * have Predef imported? |