Skip to content

Commit 6690455

Browse files
committed
SI-7335 Remove special case for import of Predef._ in Predef.scala
Perhaps this once was problematic, but in our modern age we can bootstrap perfectly well with this import.
1 parent b0fceeb commit 6690455

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/reflect/scala/reflect/internal/TreeInfo.scala

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -663,19 +663,9 @@ abstract class TreeInfo {
663663
unapply(dissectApplied(tree))
664664
}
665665

666-
/** Does list of trees start with a definition of
667-
* a class of module with given name (ignoring imports)
668-
*/
669-
def firstDefinesClassOrObject(trees: List[Tree], name: Name): Boolean = trees match {
670-
case Import(_, _) :: xs => firstDefinesClassOrObject(xs, name)
671-
case Annotated(_, tree1) :: _ => firstDefinesClassOrObject(List(tree1), name)
672-
case ModuleDef(_, `name`, _) :: _ => true
673-
case ClassDef(_, `name`, _, _) :: _ => true
674-
case _ => false
675-
}
676-
677666
/** Is this file the body of a compilation unit which should not
678-
* have Predef imported?
667+
* have Predef imported? This is the case iff the first import in the
668+
* unit explicitly refers to Predef.
679669
*/
680670
def noPredefImportForUnit(body: Tree) = {
681671
// Top-level definition whose leading imports include Predef.
@@ -684,13 +674,7 @@ abstract class TreeInfo {
684674
case Import(expr, _) => isReferenceToPredef(expr)
685675
case _ => false
686676
}
687-
// Compilation unit is class or object 'name' in package 'scala'
688-
def isUnitInScala(tree: Tree, name: Name) = tree match {
689-
case PackageDef(Ident(nme.scala_), defs) => firstDefinesClassOrObject(defs, name)
690-
case _ => false
691-
}
692-
693-
isUnitInScala(body, nme.Predef) || isLeadingPredefImport(body)
677+
isLeadingPredefImport(body)
694678
}
695679

696680
def isAbsTypeDef(tree: Tree) = tree match {

0 commit comments

Comments
 (0)