summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-27 12:28:55 -0700
committerPaul Phillips <paulp@improving.org>2013-10-02 08:59:55 -0700
commitaced32d05c97651534f468bc9a475ea5f6ae75b8 (patch)
treefda8b628ae8501a8df945aeb7f558f259c857e62 /src
parent45183d8d28ff082d9186018b707f9fecb466f14f (diff)
downloadscala-aced32d05c97651534f468bc9a475ea5f6ae75b8.tar.gz
scala-aced32d05c97651534f468bc9a475ea5f6ae75b8.tar.bz2
scala-aced32d05c97651534f468bc9a475ea5f6ae75b8.zip
Removing unused code.
Most of this was revealed via -Xlint with a flag which assumes closed world. I can't see how to check the assumes-closed-world code in without it being an ordeal. I'll leave it in a branch in case anyone wants to finish the long slog to the merge.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/macros/compiler/Validators.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala11
-rw-r--r--src/compiler/scala/tools/nsc/PhaseAssembly.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Properties.scala1
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala14
-rw-r--r--src/compiler/scala/tools/nsc/ast/Printers.scala22
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala15
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala19
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala3
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala11
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/xml/MarkupParserCommon.scala44
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala13
-rw-r--r--src/compiler/scala/tools/nsc/backend/Platform.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodes.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala6
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Primitives.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala15
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala173
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala124
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala3
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala143
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/Inliners.scala12
-rw-r--r--src/compiler/scala/tools/nsc/io/Socket.scala7
-rw-r--r--src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala5
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala12
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala11
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala19
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeStrings.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala14
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala5
-rw-r--r--src/compiler/scala/tools/nsc/util/package.scala3
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala4
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Holes.scala10
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Placeholders.scala2
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala1
-rw-r--r--src/library/scala/collection/parallel/ParIterableLike.scala2
-rw-r--r--src/library/scala/runtime/Null$.scala1
-rw-r--r--src/manual/scala/tools/docutil/EmitManPage.scala2
-rw-r--r--src/manual/scala/tools/docutil/ManPage.scala2
-rw-r--r--src/reflect/scala/reflect/api/Quasiquotes.scala2
-rw-r--r--src/reflect/scala/reflect/internal/BuildUtils.scala6
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala44
-rw-r--r--src/reflect/scala/reflect/internal/HasFlags.scala8
-rw-r--r--src/reflect/scala/reflect/internal/Mode.scala1
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala32
-rw-r--r--src/reflect/scala/reflect/internal/TreeGen.scala8
-rw-r--r--src/reflect/scala/reflect/internal/TreeInfo.scala48
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala6
-rw-r--r--src/reflect/scala/reflect/internal/TypeDebugging.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala10
-rw-r--r--src/reflect/scala/reflect/internal/tpe/TypeMaps.scala16
-rw-r--r--src/reflect/scala/reflect/internal/transform/Erasure.scala5
-rw-r--r--src/reflect/scala/reflect/internal/util/SourceFile.scala1
-rw-r--r--src/reflect/scala/reflect/internal/util/TableDef.scala17
-rw-r--r--src/reflect/scala/reflect/internal/util/WeakHashSet.scala25
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala5
-rw-r--r--src/reflect/scala/reflect/runtime/Settings.scala1
-rw-r--r--src/reflect/scala/reflect/runtime/TwoWayCache.scala12
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ByteCode.scala32
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Completion.scala2
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ExprTyper.scala1
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala1
-rw-r--r--src/repl/scala/tools/nsc/interpreter/IMain.scala10
-rw-r--r--src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala1
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ReplStrings.scala2
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala1
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala10
82 files changed, 63 insertions, 1047 deletions
diff --git a/src/compiler/scala/reflect/macros/compiler/Validators.scala b/src/compiler/scala/reflect/macros/compiler/Validators.scala
index 8d396a56d8..b3e8131e34 100644
--- a/src/compiler/scala/reflect/macros/compiler/Validators.scala
+++ b/src/compiler/scala/reflect/macros/compiler/Validators.scala
@@ -146,7 +146,7 @@ trait Validators {
val ctxPrefix =
if (isImplMethod) singleType(NoPrefix, makeParam(nme.macroContext, macroDdef.pos, ctxTpe, SYNTHETIC))
else singleType(ThisType(macroImpl.owner), macroImpl.owner.tpe.member(nme.c))
- var paramss =
+ val paramss =
if (isImplMethod) List(ctxPrefix.termSymbol) :: mmap(macroDdef.vparamss)(param)
else mmap(macroDdef.vparamss)(param)
val macroDefRet =
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index f3a2d49697..ef9d8a310e 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -14,7 +14,7 @@ import scala.compat.Platform.currentTime
import scala.collection.{ mutable, immutable }
import io.{ SourceReader, AbstractFile, Path }
import reporters.{ Reporter, ConsoleReporter }
-import util.{ ClassPath, MergedClassPath, StatisticsInfo, returning, stackTraceString, stackTraceHeadString }
+import util.{ ClassPath, MergedClassPath, StatisticsInfo, returning, stackTraceString }
import scala.reflect.internal.util.{ OffsetPosition, SourceFile, NoSourceFile, BatchSourceFile, ScriptSourceFile }
import scala.reflect.internal.pickling.{ PickleBuffer, PickleFormat }
import scala.reflect.io.VirtualFile
@@ -1026,14 +1026,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
* Then, fsc -Xexperimental clears the nsc project between successive runs of `fsc`.
*/
- /** Remove the current run when not needed anymore. Used by the build
- * manager to save on the memory foot print. The current run holds on
- * to all compilation units, which in turn hold on to trees.
- */
- private [nsc] def dropRun() {
- curRun = null
- }
-
object typeDeconstruct extends {
val global: Global.this.type = Global.this
} with typechecker.StructuredTypeStrings
@@ -1083,7 +1075,6 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
@inline final def enteringIcode[T](op: => T): T = enteringPhase(currentRun.icodePhase)(op)
@inline final def enteringMixin[T](op: => T): T = enteringPhase(currentRun.mixinPhase)(op)
@inline final def enteringPickler[T](op: => T): T = enteringPhase(currentRun.picklerPhase)(op)
- @inline final def enteringRefchecks[T](op: => T): T = enteringPhase(currentRun.refchecksPhase)(op)
@inline final def enteringSpecialize[T](op: => T): T = enteringPhase(currentRun.specializePhase)(op)
@inline final def enteringTyper[T](op: => T): T = enteringPhase(currentRun.typerPhase)(op)
@inline final def enteringUncurry[T](op: => T): T = enteringPhase(currentRun.uncurryPhase)(op)
diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
index 996f6efe55..cfb4cd23a1 100644
--- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala
+++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
@@ -144,7 +144,7 @@ trait PhaseAssembly {
rerun = false
hardlinks = edges.filter(_.hard)
for (hl <- hardlinks) {
- var sanity = Nil ++ hl.to.before.filter(_.hard)
+ val sanity = Nil ++ hl.to.before.filter(_.hard)
if (sanity.length == 0) {
throw new FatalError("There is no runs right after dependency, where there should be one! This is not supposed to happen!")
} else if (sanity.length > 1) {
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala
index feb4ded2f2..ed5fda9c3f 100644
--- a/src/compiler/scala/tools/nsc/Properties.scala
+++ b/src/compiler/scala/tools/nsc/Properties.scala
@@ -12,7 +12,6 @@ object Properties extends scala.util.PropertiesTrait {
protected def pickJarBasedOn = classOf[Global]
// settings based on jar properties
- def fileEndingString = scalaPropOrElse("file.ending", ".scala|.java")
def residentPromptString = scalaPropOrElse("resident.prompt", "\nnsc> ")
def shellPromptString = scalaPropOrElse("shell.prompt", "\nscala> ")
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 7cf2f8559b..6d9b41ec45 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -33,11 +33,6 @@ trait DocComments { self: Global =>
defs.clear()
}
- /** Associate comment with symbol `sym` at position `pos`. */
- def docComment(sym: Symbol, docStr: String, pos: Position = NoPosition) =
- if ((sym ne null) && (sym ne NoSymbol))
- docComments += (sym -> DocComment(docStr, pos))
-
/** The raw doc comment of symbol `sym`, as it appears in the source text, "" if missing.
*/
def rawDocComment(sym: Symbol): String =
@@ -99,11 +94,6 @@ trait DocComments { self: Global =>
expandVariables(cookedDocComment(sym, docStr), sym, site1)
}
- /** The cooked doc comment of symbol `sym` after variable expansion, or "" if missing.
- * @param sym The symbol for which doc comment is returned (site is always the containing class)
- */
- def expandedDocComment(sym: Symbol): String = expandedDocComment(sym, sym.enclClass)
-
/** The list of use cases of doc comment of symbol `sym` seen as a member of class
* `site`. Each use case consists of a synthetic symbol (which is entered nowhere else),
* of an expanded doc comment string, and of its position.
@@ -132,10 +122,6 @@ trait DocComments { self: Global =>
getDocComment(sym) map getUseCases getOrElse List()
}
- /** Returns the javadoc format of doc comment string `s`, including wiki expansion
- */
- def toJavaDoc(s: String): String = expandWiki(s)
-
private val wikiReplacements = List(
("""(\n\s*\*?)(\s*\n)""" .r, """$1 <p>$2"""),
("""<([^\w/])""" .r, """&lt;$1"""),
diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala
index c31b5e2c0e..c64b18207a 100644
--- a/src/compiler/scala/tools/nsc/ast/Printers.scala
+++ b/src/compiler/scala/tools/nsc/ast/Printers.scala
@@ -178,28 +178,6 @@ trait Printers extends scala.reflect.internal.Printers { this: Global =>
}
}
- /** This must guarantee not to force any evaluation, so we can learn
- * a little bit about trees in the midst of compilation without altering
- * the natural course of events.
- */
- class SafeTreePrinter(out: PrintWriter) extends TreePrinter(out) {
-
- private def default(t: Tree) = t.getClass.getName.reverse.takeWhile(_ != '.').reverse
- private def params(trees: List[Tree]): String = trees map safe mkString ", "
-
- private def safe(name: Name): String = name.decode
- private def safe(tree: Tree): String = tree match {
- case Apply(fn, args) => "%s(%s)".format(safe(fn), params(args))
- case Select(qual, name) => safe(qual) + "." + safe(name)
- case This(qual) => safe(qual) + ".this"
- case Ident(name) => safe(name)
- case Literal(value) => value.stringValue
- case _ => "(?: %s)".format(default(tree))
- }
-
- override def printTree(tree: Tree) { print(safe(tree)) }
- }
-
def asString(t: Tree): String = render(t, newStandardTreePrinter, settings.printtypes, settings.uniqid, settings.Yshowsymkinds)
def asCompactString(t: Tree): String = render(t, newCompactTreePrinter, settings.printtypes, settings.uniqid, settings.Yshowsymkinds)
def asCompactDebugString(t: Tree): String = render(t, newCompactTreePrinter, true, true, true)
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index 1e70b7091b..c68b248240 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -49,21 +49,6 @@ abstract class TreeBrowsers {
* Java Swing pretty printer for Scala abstract syntax trees.
*/
class SwingBrowser {
-
- def browse(t: Tree): Tree = {
- val tm = new ASTTreeModel(t)
-
- val frame = new BrowserFrame()
- frame.setTreeModel(tm)
-
- val lock = new Lock()
- frame.createFrame(lock)
-
- // wait for the frame to be closed
- lock.acquire()
- t
- }
-
def browse(pName: String, units: Iterator[CompilationUnit]): Unit =
browse(pName, units.toList)
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index 5922b4bbbf..0020528c5b 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -7,7 +7,6 @@
package scala.tools.nsc
package ast
-import PartialFunction._
import symtab.Flags
import scala.language.implicitConversions
@@ -32,7 +31,6 @@ trait TreeDSL {
object LIT extends (Any => Literal) {
def typed(x: Any) = apply(x) setType ConstantType(Constant(x))
def apply(x: Any) = Literal(Constant(x))
- def unapply(x: Any) = condOpt(x) { case Literal(Constant(value)) => value }
}
// Boring, predictable trees.
@@ -42,12 +40,6 @@ trait TreeDSL {
def NULL = LIT(null)
def UNIT = LIT(())
- object WILD {
- def empty = Ident(nme.WILDCARD)
- def apply(tpe: Type) = Ident(nme.WILDCARD) setType tpe
- def unapply(other: Any) = cond(other) { case Ident(nme.WILDCARD) => true }
- }
-
def fn(lhs: Tree, op: Name, args: Tree*) = Apply(Select(lhs, op), args.toList)
def fn(lhs: Tree, op: Symbol, args: Tree*) = Apply(Select(lhs, op), args.toList)
@@ -77,7 +69,6 @@ trait TreeDSL {
def ANY_EQ (other: Tree) = OBJ_EQ(other AS ObjectTpe)
def ANY_== (other: Tree) = fn(target, Any_==, other)
def ANY_!= (other: Tree) = fn(target, Any_!=, other)
- def OBJ_!= (other: Tree) = fn(target, Object_!=, other)
def OBJ_EQ (other: Tree) = fn(target, Object_eq, other)
def OBJ_NE (other: Tree) = fn(target, Object_ne, other)
@@ -94,7 +85,6 @@ trait TreeDSL {
/** Apply, Select, Match **/
def APPLY(params: Tree*) = Apply(target, params.toList)
def APPLY(params: List[Tree]) = Apply(target, params)
- def MATCH(cases: CaseDef*) = Match(target, cases.toList)
def DOT(member: Name) = SelectStart(Select(target, member))
def DOT(sym: Symbol) = SelectStart(Select(target, sym))
@@ -106,21 +96,14 @@ trait TreeDSL {
// clear how to proceed, so for now it retains the non-duplicating behavior.
def ===(rhs: Tree) = Assign(target, rhs)
- /** Methods for sequences **/
- def DROP(count: Int): Tree =
- if (count == 0) target
- else (target DOT nme.drop)(LIT(count))
-
/** Casting & type tests -- working our way toward understanding exactly
* what differs between the different forms of IS and AS.
*
* See ticket #2168 for one illustration of AS vs. AS_ANY.
*/
def AS(tpe: Type) = gen.mkAsInstanceOf(target, tpe, any = true, wrapInApply = false)
- def IS(tpe: Type) = gen.mkIsInstanceOf(target, tpe, any = true)
def IS_OBJ(tpe: Type) = gen.mkIsInstanceOf(target, tpe, any = false)
- def TOSTRING() = fn(target, nme.toString_)
def GETCLASS() = fn(target, Object_getClass)
}
@@ -144,7 +127,7 @@ trait TreeDSL {
}
def CASE(pat: Tree): CaseStart = new CaseStart(pat, EmptyTree)
- def DEFAULT: CaseStart = new CaseStart(WILD.empty, EmptyTree)
+ def DEFAULT: CaseStart = new CaseStart(Ident(nme.WILDCARD), EmptyTree)
def NEW(tpt: Tree, args: Tree*): Tree = New(tpt, List(args.toList))
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index bdff5e1344..cccae0c3a0 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -80,8 +80,6 @@ trait Trees extends scala.reflect.internal.Trees { self: Global =>
val global: Trees.this.type = self
} with TreeInfo
- lazy val treePrinter = newTreePrinter()
-
// --- additional cases in operations ----------------------------------
override protected def xtraverse(traverser: Traverser, tree: Tree): Unit = tree match {
@@ -185,7 +183,6 @@ trait Trees extends scala.reflect.internal.Trees { self: Global =>
def resetAllAttrs(x: Tree, leaveAlone: Tree => Boolean = null): Tree = new ResetAttrs(false, leaveAlone).transform(x)
def resetLocalAttrs(x: Tree, leaveAlone: Tree => Boolean = null): Tree = new ResetAttrs(true, leaveAlone).transform(x)
- def resetLocalAttrsKeepLabels(x: Tree, leaveAlone: Tree => Boolean = null): Tree = new ResetAttrs(true, leaveAlone, true).transform(x)
/** A transformer which resets symbol and tpe fields of all nodes in a given tree,
* with special treatment of:
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index d75e39ae00..34f3fcce9f 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -649,10 +649,6 @@ self =>
}
def isDefIntro = isTemplateIntro || isDclIntro
- def isTopLevelIntro = in.token match {
- case PACKAGE | IMPORT | AT => true
- case _ => isTemplateIntro || isModifier
- }
def isNumericLit: Boolean = in.token match {
case INTLIT | LONGLIT | FLOATLIT | DOUBLELIT => true
@@ -2995,13 +2991,6 @@ self =>
stats.toList
}
- /** Informal - for the repl and other direct parser accessors.
- */
- def templateStatsCompat(): List[Tree] = templateStats() match {
- case Nil => EmptyTree.asList
- case stats => stats
- }
-
/** {{{
* RefineStatSeq ::= RefineStat {semi RefineStat}
* RefineStat ::= Dcl
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 2d38848f90..59abf99844 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -31,8 +31,6 @@ abstract class TreeBuilder {
def scalaDot(name: Name) = gen.scalaDot(name)
def scalaAnyRefConstr = scalaDot(tpnme.AnyRef)
def scalaUnitConstr = scalaDot(tpnme.Unit)
- def productConstr = scalaDot(tpnme.Product)
- def serializableConstr = scalaDot(tpnme.Serializable)
def convertToTypeName(t: Tree) = gen.convertToTypeName(t)
diff --git a/src/compiler/scala/tools/nsc/ast/parser/xml/MarkupParserCommon.scala b/src/compiler/scala/tools/nsc/ast/parser/xml/MarkupParserCommon.scala
index f6cfb64ed8..82dce9f1f8 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/xml/MarkupParserCommon.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/xml/MarkupParserCommon.scala
@@ -18,8 +18,6 @@ private[scala] trait MarkupParserCommon {
protected def unreachable = scala.sys.error("Cannot be reached.")
- // type HandleType // MarkupHandler, SymbolicXMLBuilder
- type InputType // Source, CharArrayReader
type PositionType // Int, Position
type ElementType // NodeSeq, Tree
type NamespaceType // NamespaceBinding, Any
@@ -65,21 +63,6 @@ private[scala] trait MarkupParserCommon {
buf.toString
}
- def xAttributeValue(): String = {
- val str = xAttributeValue(ch_returning_nextch)
- // well-formedness constraint
- normalizeAttributeValue(str)
- }
-
- private def takeUntilChar(it: Iterator[Char], end: Char): String = {
- val buf = new StringBuilder
- while (it.hasNext) it.next() match {
- case `end` => return buf.toString
- case ch => buf append ch
- }
- scala.sys.error("Expected '%s'".format(end))
- }
-
/** [42] '<' xmlEndTag ::= '<' '/' Name S? '>'
*/
def xEndTag(startName: String) {
@@ -117,33 +100,6 @@ private[scala] trait MarkupParserCommon {
else buf.toString
}
- private def attr_unescape(s: String) = s match {
- case "lt" => "<"
- case "gt" => ">"
- case "amp" => "&"
- case "apos" => "'"
- case "quot" => "\""
- case "quote" => "\""
- case _ => "&" + s + ";"
- }
-
- /** Replaces only character references right now.
- * see spec 3.3.3
- */
- private def normalizeAttributeValue(attval: String): String = {
- val buf = new StringBuilder
- val it = attval.iterator.buffered
-
- while (it.hasNext) buf append (it.next() match {
- case ' ' | '\t' | '\n' | '\r' => " "
- case '&' if it.head == '#' => it.next() ; xCharRef(it)
- case '&' => attr_unescape(takeUntilChar(it, ';'))
- case c => c
- })
-
- buf.toString
- }
-
/** CharRef ::= "&#" '0'..'9' {'0'..'9'} ";"
* | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"
*
diff --git a/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala b/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
index 39e4831af2..6dcfa173df 100755
--- a/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
@@ -122,10 +122,6 @@ object Utility {
case '\u0009' | '\u000A' | '\u000D' | '\u0020' => true
case _ => false
}
- /** {{{
- * (#x20 | #x9 | #xD | #xA)+
- * }}} */
- final def isSpace(cs: Seq[Char]): Boolean = cs.nonEmpty && (cs forall isSpace)
/** {{{
* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':'
@@ -164,13 +160,4 @@ object Utility {
case _ => ch == '_'
}
}
-
- /** {{{
- * Name ::= ( Letter | '_' ) (NameChar)*
- * }}}
- * See [5] of XML 1.0 specification.
- */
- def isName(s: String) =
- s.nonEmpty && isNameStart(s.head) && (s.tail forall isNameChar)
-
}
diff --git a/src/compiler/scala/tools/nsc/backend/Platform.scala b/src/compiler/scala/tools/nsc/backend/Platform.scala
index 3bca16635b..499f8a9290 100644
--- a/src/compiler/scala/tools/nsc/backend/Platform.scala
+++ b/src/compiler/scala/tools/nsc/backend/Platform.scala
@@ -15,10 +15,6 @@ trait Platform {
val symbolTable: symtab.SymbolTable
import symbolTable._
- /** The binary classfile representation type */
- @deprecated("BinaryRepr is not an abstract type anymore. It's an alias that points at AbstractFile. It'll be removed before Scala 2.11 is released.", "2.11.0-M5")
- type BinaryRepr = AbstractFile
-
/** The compiler classpath. */
def classPath: ClassPath[AbstractFile]
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index 26d10d2514..f9551697d2 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -452,10 +452,6 @@ trait BasicBlocks {
if (closed) instrs(instrs.length - 1)
else instructionList.head
- def firstInstruction =
- if (closed) instrs(0)
- else instructionList.last
-
def exceptionSuccessors: List[BasicBlock] =
exceptionSuccessorsForBlock(this)
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
index b9eb8f8aac..bc35a9e7de 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
@@ -105,7 +105,6 @@ abstract class ICodes extends AnyRef
lazy val NullReference: TypeKind = REFERENCE(definitions.NullClass)
lazy val ObjectReference: TypeKind = REFERENCE(definitions.ObjectClass)
lazy val StringReference: TypeKind = REFERENCE(definitions.StringClass)
- lazy val ThrowableReference: TypeKind = REFERENCE(definitions.ThrowableClass)
object icodeReader extends ICodeReader {
lazy val global: ICodes.this.global.type = ICodes.this.global
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index 91bd39232e..4d1d59cd12 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -282,12 +282,6 @@ trait Members {
class Local(val sym: Symbol, val kind: TypeKind, val arg: Boolean) {
var index: Int = -1
- /** Starting PC for this local's visibility range. */
- var start: Int = _
-
- /** PC-based ranges for this local variable's visibility */
- var ranges: List[(Int, Int)] = Nil
-
override def equals(other: Any): Boolean = other match {
case x: Local => sym == x.sym
case _ => false
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
index 4fa717309e..f81c42d836 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala
@@ -80,8 +80,6 @@ trait Primitives { self: ICodes =>
out.print(s)
this
}
-
- def print(o: AnyRef): PrimitivePrinter = print(o.toString())
}
/** This class represents a comparison operation. */
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 817546b0f1..3bacc26a3a 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -43,8 +43,6 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
/* ---------------- helper utils for generating methods and code ---------------- */
def emit(opc: Int) { mnode.visitInsn(opc) }
- def emit(i: asm.tree.AbstractInsnNode) { mnode.instructions.add(i) }
- def emit(is: List[asm.tree.AbstractInsnNode]) { for(i <- is) { mnode.instructions.add(i) } }
def emitZeroOf(tk: BType) {
(tk.sort: @switch) match {
@@ -411,7 +409,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
/*
* must-single-thread
*/
- private def fieldOp(field: Symbol, isLoad: Boolean, hostClass: Symbol = null) {
+ private def fieldOp(field: Symbol, isLoad: Boolean, hostClass: Symbol) {
// LOAD_FIELD.hostClass , CALL_METHOD.hostClass , and #4283
val owner =
if (hostClass == null) internalName(field.owner)
@@ -950,13 +948,6 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
|| sym.isJavaDefined && sym.isNonBottomSubClass(definitions.ClassfileAnnotationClass)
)
- def isAccessibleFrom(target: Symbol, site: Symbol): Boolean = {
- target.isPublic || target.isProtected && {
- (site.enclClass isSubClass target.enclClass) ||
- (site.enclosingPackage == target.privateWithin)
- }
- }
-
// whether to reference the type of the receiver or
// the type of the method owner
val useMethodOwner = (
@@ -1233,10 +1224,6 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
}
}
- /* can-multi-thread */
- def getMaxType(ts: List[Type]): BType = {
- ts map toTypeKind reduceLeft maxType
- }
def genSynchronized(tree: Apply, expectedType: BType): BType
def genLoadTry(tree: Try): BType
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala
index f95ceef678..9dcf263f4f 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala
@@ -119,16 +119,6 @@ abstract class BCodeGlue extends SubComponent {
}
/*
- * @param typeDescriptor a field or method type descriptor.
- *
- * must-single-thread
- */
- def getType(typeDescriptor: String): BType = {
- val n = global.newTypeName(typeDescriptor)
- getType(n.start)
- }
-
- /*
* @param methodDescriptor a method descriptor.
*
* must-single-thread
@@ -177,20 +167,6 @@ abstract class BCodeGlue extends SubComponent {
}
/*
- * Returns the Java types corresponding to the argument types of the given
- * method descriptor.
- *
- * @param methodDescriptor a method descriptor.
- * @return the Java types corresponding to the argument types of the given method descriptor.
- *
- * must-single-thread
- */
- def getArgumentTypes(methodDescriptor: String): Array[BType] = {
- val n = global.newTypeName(methodDescriptor)
- getArgumentTypes(n.start + 1)
- }
-
- /*
* Returns the number of argument types of this method type, whose first argument starts at idx0.
*
* @param idx0 index into chrs of the first argument.
@@ -349,19 +325,6 @@ abstract class BCodeGlue extends SubComponent {
}
/*
- * @return the prefix of the internal name until the last '/' (if '/' present), empty string otherwise.
- *
- * can-multi-thread
- */
- def getRuntimePackage: String = {
- assert(hasObjectSort, s"not of object sort: $toString")
- val iname = getInternalName
- val idx = iname.lastIndexOf('/')
- if (idx == -1) ""
- else iname.substring(0, idx)
- }
-
- /*
* @return the suffix of the internal name until the last '/' (if '/' present), internal name otherwise.
*
* can-multi-thread
@@ -387,18 +350,6 @@ abstract class BCodeGlue extends SubComponent {
}
/*
- * Returns the number of arguments of methods of this type.
- * This method should only be used for method types.
- *
- * @return the number of arguments of methods of this type.
- *
- * can-multi-thread
- */
- def getArgumentCount: Int = {
- BType.getArgumentCount(off + 1)
- }
-
- /*
* Returns the return type of methods of this type.
* This method should only be used for method types.
*
@@ -413,38 +364,6 @@ abstract class BCodeGlue extends SubComponent {
BType.getType(resPos + 1)
}
- /*
- * Given a zero-based formal-param-position, return its corresponding local-var-index,
- * taking into account the JVM-type-sizes of preceding formal params.
- */
- def convertFormalParamPosToLocalVarIdx(paramPos: Int, isInstanceMethod: Boolean): Int = {
- assert(sort == asm.Type.METHOD)
- val paramTypes = getArgumentTypes
- var local = 0
- (0 until paramPos) foreach { argPos => local += paramTypes(argPos).getSize }
-
- local + (if (isInstanceMethod) 1 else 0)
- }
-
- /*
- * Given a local-var-index, return its corresponding zero-based formal-param-position,
- * taking into account the JVM-type-sizes of preceding formal params.
- */
- def convertLocalVarIdxToFormalParamPos(localIdx: Int, isInstanceMethod: Boolean): Int = {
- assert(sort == asm.Type.METHOD)
- val paramTypes = getArgumentTypes
- var remaining = (if (isInstanceMethod) (localIdx - 1) else localIdx)
- assert(remaining >= 0)
- var result = 0
- while (remaining > 0) {
- remaining -= paramTypes(result).getSize
- result += 1
- }
- assert(remaining == 0)
-
- result
- }
-
// ------------------------------------------------------------------------
// Inspector methods
// ------------------------------------------------------------------------
@@ -521,14 +440,6 @@ abstract class BCodeGlue extends SubComponent {
*/
def isWideType = (getSize == 2)
- def isCapturedCellRef: Boolean = {
- this == srBooleanRef || this == srByteRef ||
- this == srCharRef ||
- this == srIntRef ||
- this == srLongRef ||
- this == srFloatRef || this == srDoubleRef
- }
-
/*
* Element vs. Component type of an array:
* Quoting from the JVMS, Sec. 2.4 "Reference Types and Values"
@@ -750,14 +661,6 @@ abstract class BCodeGlue extends SubComponent {
val CT_NOTHING = brefType("scala/Nothing") // TODO needed?
val CT_NULL = brefType("scala/Null") // TODO needed?
- val srBooleanRef = brefType("scala/runtime/BooleanRef")
- val srByteRef = brefType("scala/runtime/ByteRef")
- val srCharRef = brefType("scala/runtime/CharRef")
- val srIntRef = brefType("scala/runtime/IntRef")
- val srLongRef = brefType("scala/runtime/LongRef")
- val srFloatRef = brefType("scala/runtime/FloatRef")
- val srDoubleRef = brefType("scala/runtime/DoubleRef")
-
/* Map from type kinds to the Java reference types.
* Useful when pushing class literals onto the operand stack (ldc instruction taking a class literal).
* @see Predef.classOf
@@ -802,80 +705,4 @@ abstract class BCodeGlue extends SubComponent {
DOUBLE -> MethodNameAndType("unboxToDouble", "(Ljava/lang/Object;)D")
)
}
-
- /*
- * can-multi-thread
- */
- def toBType(t: asm.Type): BType = {
- (t.getSort: @switch) match {
- case asm.Type.VOID => BType.VOID_TYPE
- case asm.Type.BOOLEAN => BType.BOOLEAN_TYPE
- case asm.Type.CHAR => BType.CHAR_TYPE
- case asm.Type.BYTE => BType.BYTE_TYPE
- case asm.Type.SHORT => BType.SHORT_TYPE
- case asm.Type.INT => BType.INT_TYPE
- case asm.Type.FLOAT => BType.FLOAT_TYPE
- case asm.Type.LONG => BType.LONG_TYPE
- case asm.Type.DOUBLE => BType.DOUBLE_TYPE
- case asm.Type.ARRAY |
- asm.Type.OBJECT |
- asm.Type.METHOD =>
- // TODO confirm whether this also takes care of the phantom types.
- val key =
- if (t.getSort == asm.Type.METHOD) t.getDescriptor
- else t.getInternalName
-
- val n = global.lookupTypeName(key.toCharArray)
- new BType(t.getSort, n.start, n.length)
- }
- }
-
- /*
- * ASM trees represent types as strings (internal names, descriptors).
- * Given that we operate instead on BTypes, conversion is needed when visiting MethodNodes outside GenBCode.
- *
- * can-multi-thread
- */
- def descrToBType(typeDescriptor: String): BType = {
- val c: Char = typeDescriptor(0)
- c match {
- case 'V' => BType.VOID_TYPE
- case 'Z' => BType.BOOLEAN_TYPE
- case 'C' => BType.CHAR_TYPE
- case 'B' => BType.BYTE_TYPE
- case 'S' => BType.SHORT_TYPE
- case 'I' => BType.INT_TYPE
- case 'F' => BType.FLOAT_TYPE
- case 'J' => BType.LONG_TYPE
- case 'D' => BType.DOUBLE_TYPE
- case 'L' =>
- val iname = typeDescriptor.substring(1, typeDescriptor.length() - 1)
- val n = global.lookupTypeName(iname.toCharArray)
- new BType(asm.Type.OBJECT, n.start, n.length)
- case _ =>
- val n = global.lookupTypeName(typeDescriptor.toCharArray)
- BType.getType(n.start)
- }
- }
-
- /*
- * Use only to lookup reference types, otherwise use `descrToBType()`
- *
- * can-multi-thread
- */
- def lookupRefBType(iname: String): BType = {
- import global.chrs
- val n = global.lookupTypeName(iname.toCharArray)
- val sort = if (chrs(n.start) == '[') BType.ARRAY else BType.OBJECT;
- new BType(sort, n.start, n.length)
- }
-
- def lookupRefBTypeIfExisting(iname: String): BType = {
- import global.chrs
- val n = global.lookupTypeNameIfExisting(iname.toCharArray, false)
- if (n == null) { return null }
- val sort = if (chrs(n.start) == '[') BType.ARRAY else BType.OBJECT;
- new BType(sort, n.start, n.length)
- }
-
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
index eff7d3211e..c22ced26a5 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
@@ -561,9 +561,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
memberCTK
}
-
- exemplar(csym).directMemberClasses = (result ::: lateClosuresBTs)
-
+ exemplar(csym) // side effect city
result
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
index eda17c6e32..529295389c 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
@@ -46,7 +46,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
val ObjectReference = brefType("java/lang/Object")
val AnyRefReference = ObjectReference
- val objArrayReference = arrayOf(ObjectReference)
val JAVA_LANG_OBJECT = ObjectReference
val JAVA_LANG_STRING = brefType("java/lang/String")
@@ -73,11 +72,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
if (xs.isEmpty) { return EMPTY_LABEL_ARRAY }
val a = new Array[asm.Label](xs.size); xs.copyToArray(a); a
}
- /* can-multi-thread */
- final def mkArray(xs: List[Int]): Array[Int] = {
- if (xs.isEmpty) { return EMPTY_INT_ARRAY }
- val a = new Array[Int](xs.size); xs.copyToArray(a); a
- }
/*
* can-multi-thread
@@ -114,23 +108,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
}
/*
- * can-multi-thread
- */
- final def mkArrayReverse(xs: List[asm.Label]): Array[asm.Label] = {
- val len = xs.size
- if (len == 0) { return EMPTY_LABEL_ARRAY }
- val a = new Array[asm.Label](len)
- var i = len - 1
- var rest = xs
- while (!rest.isEmpty) {
- a(i) = rest.head
- rest = rest.tail
- i -= 1
- }
- a
- }
-
- /*
* The type of 1-dimensional arrays of `elem` type.
* The invoker is responsible for tracking (if needed) the inner class given by the elem BType.
*
@@ -141,20 +118,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
brefType("[" + elem.getDescriptor)
}
- /*
- * The type of N-dimensional arrays of `elem` type.
- * The invoker is responsible for tracking (if needed) the inner class given by the elem BType.
- *
- * must-single-thread
- */
- final def arrayN(elem: BType, dims: Int): BType = {
- assert(dims > 0)
- assert(!(elem.isUnitType) && !(elem.isPhantomType),
- "The element type of an array type is necessarily either a primitive type, or a class type, or an interface type.")
- val desc = ("[" * dims) + elem.getDescriptor
- brefType(desc)
- }
-
/* Just a namespace for utilities that encapsulate MethodVisitor idioms.
* In the ASM world, org.objectweb.asm.commons.InstructionAdapter plays a similar role,
* but the methods here allow choosing when to transition from ICode to ASM types
@@ -165,7 +128,7 @@ abstract class BCodeIdiomatic extends BCodeGlue {
def jmethod: asm.MethodVisitor
import asm.Opcodes;
- import icodes.opcodes.{ InvokeStyle, Static, Dynamic, SuperCall }
+ import icodes.opcodes.{ Static, Dynamic, SuperCall }
final def emit(opc: Int) { jmethod.visitInsn(opc) }
@@ -262,23 +225,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
/*
* can-multi-thread
*/
- final def genPrimitiveComparison(op: icodes.ComparisonOp, kind: BType) {
-
- import icodes.{ CMPL, CMP, CMPG }
-
- ((op, kind): @unchecked) match {
- case (CMP, LONG) => emit(Opcodes.LCMP)
- case (CMPL, FLOAT) => emit(Opcodes.FCMPL)
- case (CMPG, FLOAT) => emit(Opcodes.FCMPG)
- case (CMPL, DOUBLE) => emit(Opcodes.DCMPL)
- case (CMPG, DOUBLE) => emit(Opcodes.DCMPL) // http://docs.oracle.com/javase/specs/jvms/se5.0/html/Instructions2.doc3.html
- }
-
- } // end of method genPrimitiveComparison()
-
- /*
- * can-multi-thread
- */
final def genStartConcat {
jmethod.visitTypeInsn(Opcodes.NEW, StringBuilderClassName)
jmethod.visitInsn(Opcodes.DUP)
@@ -379,12 +325,6 @@ abstract class BCodeIdiomatic extends BCodeGlue {
} // end of emitT2T()
// can-multi-thread
- final def aconst(cst: AnyRef) {
- if (cst == null) { emit(Opcodes.ACONST_NULL) }
- else { jmethod.visitLdcInsn(cst) }
- }
-
- // can-multi-thread
final def boolconst(b: Boolean) { iconst(if (b) 1 else 0) }
// can-multi-thread
@@ -768,22 +708,8 @@ abstract class BCodeIdiomatic extends BCodeGlue {
}
}
- implicit class MethodIterClassNode(cnode: asm.tree.ClassNode) {
-
- @inline final def foreachMethod(f: (asm.tree.MethodNode) => Unit) { toMethodList.foreach(f) }
-
- @inline final def toMethodList: List[asm.tree.MethodNode] = { JListWrapper(cnode.methods).toList }
-
- @inline final def toFieldList: List[asm.tree.FieldNode] = { JListWrapper(cnode.fields).toList }
-
- }
-
implicit class InsnIterMethodNode(mnode: asm.tree.MethodNode) {
-
@inline final def foreachInsn(f: (asm.tree.AbstractInsnNode) => Unit) { mnode.instructions.foreachInsn(f) }
-
- @inline final def toList: List[asm.tree.AbstractInsnNode] = { mnode.instructions.toList }
-
}
implicit class InsnIterInsnList(lst: asm.tree.InsnList) {
@@ -794,51 +720,5 @@ abstract class BCodeIdiomatic extends BCodeGlue {
f(insnIter.next())
}
}
-
- @inline final def toList: List[asm.tree.AbstractInsnNode] = {
- var result: List[asm.tree.AbstractInsnNode] = Nil
- lst foreachInsn { insn => if (insn != null) { result ::= insn } }
- result.reverse
- }
-
- }
-
- /*
- * Upon finding a name already seen among previous List elements, adds a numeric postfix to make it unique.
- */
- def uniquify(names: List[String]): List[String] = {
- val seen = mutable.Set.empty[String]
-
- @scala.annotation.tailrec def uniquified(current: String, attempt: Int): String = {
- if (seen contains current) {
- val currentBis = (current + "$" + attempt.toString)
- if (seen contains currentBis) {
- uniquified(current, attempt + 1)
- } else currentBis
- } else current
- }
-
- var rest = names
- var result: List[String] = Nil
- while (rest.nonEmpty) {
- val u = uniquified(rest.head.trim, 1)
- seen += u
- result ::= u
- rest = rest.tail
- }
-
- result.reverse
}
-
- def allDifferent[ElemType](xs: Iterable[ElemType]): Boolean = {
- val seen = mutable.Set.empty[ElemType]
- val iter = xs.iterator
- while (iter.hasNext) {
- val nxt = iter.next()
- if (seen contains nxt) { return false }
- seen += nxt
- }
- true
- }
-
-} \ No newline at end of file
+}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
index 8b6b4ab9ce..5fe03624cf 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
@@ -23,7 +23,6 @@ import scala.tools.asm
*/
abstract class BCodeSkelBuilder extends BCodeHelpers {
import global._
- import definitions._
/*
* There's a dedicated PlainClassBuilder for each CompilationUnit,
@@ -270,7 +269,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
var mnode: asm.tree.MethodNode = null
var jMethodName: String = null
var isMethSymStaticCtor = false
- var isMethSymBridge = false
var returnType: BType = null
var methSymbol: Symbol = null
// in GenASM this is local to genCode(), ie should get false whenever a new method is emitted (including fabricated ones eg addStaticInit())
@@ -553,7 +551,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
jMethodName = methSymbol.javaSimpleName.toString
returnType = asmMethodType(dd.symbol).getReturnType
isMethSymStaticCtor = methSymbol.isStaticConstructor
- isMethSymBridge = methSymbol.isBridge
resetMethodBookkeeping(dd)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
index 439be77b31..27bcbb82d4 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSyncAndTry.scala
@@ -386,9 +386,7 @@ abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
/* Does this tree have a try-catch block? */
def mayCleanStack(tree: Tree): Boolean = tree exists { t => t.isInstanceOf[Try] }
- abstract class Cleanup(val value: AnyRef) {
- def contains(x: AnyRef) = value == x
- }
+ abstract class Cleanup(val value: AnyRef) { }
case class MonitorRelease(v: Symbol) extends Cleanup(v) { }
case class Finalizer(f: Tree) extends Cleanup (f) { }
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
index 542a90fa85..39fea9a486 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
@@ -24,19 +24,13 @@ abstract class BCodeTypes extends BCodeIdiomatic {
// when compiling the Scala library, some assertions don't hold (e.g., scala.Boolean has null superClass although it's not an interface)
val isCompilingStdLib = !(settings.sourcepath.isDefault)
- val srBoxedUnit = brefType("scala/runtime/BoxedUnit")
-
// special names
var StringReference : BType = null
var ThrowableReference : BType = null
var jlCloneableReference : BType = null // java/lang/Cloneable
- var jlNPEReference : BType = null // java/lang/NullPointerException
var jioSerializableReference : BType = null // java/io/Serializable
- var scalaSerializableReference : BType = null // scala/Serializable
var classCastExceptionReference : BType = null // java/lang/ClassCastException
- var lateClosureInterfaces: Array[Tracked] = null // the only interface a Late-Closure-Class implements is scala.Serializable
-
/* A map from scala primitive type-symbols to BTypes */
var primitiveTypeMap: Map[Symbol, BType] = null
/* A map from scala type-symbols for Nothing and Null to (runtime version) BTypes */
@@ -52,15 +46,12 @@ abstract class BCodeTypes extends BCodeIdiomatic {
var AndroidParcelableInterface: Symbol = null
var AndroidCreatorClass : Symbol = null // this is an inner class, use asmType() to get hold of its BType while tracking in innerClassBufferASM
- var androidCreatorType : BType = null
var BeanInfoAttr: Symbol = null
/* The Object => String overload. */
var String_valueOf: Symbol = null
- var ArrayInterfaces: Set[Tracked] = null
-
// scala.FunctionX and scala.runtim.AbstractFunctionX
val FunctionReference = new Array[Tracked](definitions.MaxFunctionArity + 1)
val AbstractFunctionReference = new Array[Tracked](definitions.MaxFunctionArity + 1)
@@ -75,7 +66,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
* must-single-thread
*/
def initBCodeTypes() {
-
import definitions._
primitiveTypeMap =
@@ -138,19 +128,17 @@ abstract class BCodeTypes extends BCodeIdiomatic {
)
}
- ArrayInterfaces = Set(JavaCloneableClass, JavaSerializableClass) map exemplar
+ exemplar(JavaCloneableClass).c
+ exemplar(JavaSerializableClass).c
+ exemplar(SerializableClass).c
StringReference = exemplar(StringClass).c
StringBuilderReference = exemplar(StringBuilderClass).c
ThrowableReference = exemplar(ThrowableClass).c
jlCloneableReference = exemplar(JavaCloneableClass).c
- jlNPEReference = exemplar(NullPointerExceptionClass).c
jioSerializableReference = exemplar(JavaSerializableClass).c
- scalaSerializableReference = exemplar(SerializableClass).c
classCastExceptionReference = exemplar(ClassCastExceptionClass).c
- lateClosureInterfaces = Array(exemplar(SerializableClass))
-
/*
* The bytecode emitter special-cases String concatenation, in that three methods of `JCodeMethodN`
* ( `genStartConcat()` , `genStringConcat()` , and `genEndConcat()` )
@@ -215,23 +203,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
* All methods of this class can-multi-thread
*/
case class Tracked(c: BType, flags: Int, sc: Tracked, ifaces: Array[Tracked], innersChain: Array[InnerClassEntry]) {
-
- // not a case-field because we initialize it only for JVM classes we emit.
- private var _directMemberClasses: List[BType] = null
-
- def directMemberClasses: List[BType] = {
- assert(_directMemberClasses != null, s"getter directMemberClasses() invoked too early for $c")
- _directMemberClasses
- }
-
- def directMemberClasses_=(bs: List[BType]) {
- if (_directMemberClasses != null) {
- // TODO we enter here when both mirror class and plain class are emitted for the same ModuleClassSymbol.
- assert(_directMemberClasses == bs.sortBy(_.off))
- }
- _directMemberClasses = bs.sortBy(_.off)
- }
-
/* `isCompilingStdLib` saves the day when compiling:
* (1) scala.Nothing (the test `c.isNonSpecial` fails for it)
* (2) scala.Boolean (it has null superClass and is not an interface)
@@ -246,23 +217,13 @@ abstract class BCodeTypes extends BCodeIdiomatic {
import asm.Opcodes._
def hasFlags(mask: Int) = (flags & mask) != 0
- def isPrivate = hasFlags(ACC_PRIVATE)
- def isPublic = hasFlags(ACC_PUBLIC)
- def isAbstract = hasFlags(ACC_ABSTRACT)
def isInterface = hasFlags(ACC_INTERFACE)
def isFinal = hasFlags(ACC_FINAL)
- def isSynthetic = hasFlags(ACC_SYNTHETIC)
- def isSuper = hasFlags(ACC_SUPER)
- def isDeprecated = hasFlags(ACC_DEPRECATED)
def isInnerClass = { innersChain != null }
- def isTraditionalClosureClass = {
- isInnerClass && isFinal && (c.getSimpleName.contains(tpnme.ANON_FUN_NAME.toString)) && isFunctionType(c)
- }
def isLambda = {
// ie isLCC || isTraditionalClosureClass
isFinal && (c.getSimpleName.contains(tpnme.ANON_FUN_NAME.toString)) && isFunctionType(c)
}
- def isSerializable = { isSubtypeOf(jioSerializableReference) }
/* can-multi-thread */
def superClasses: List[Tracked] = {
@@ -370,16 +331,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
minimizeInterfaces(superInterfaces)
}
- final def exemplarIfExisting(iname: String): Tracked = {
- val bt = lookupRefBTypeIfExisting(iname)
- if (bt != null) exemplars.get(bt)
- else null
- }
-
- final def lookupExemplar(iname: String) = {
- exemplars.get(lookupRefBType(iname))
- }
-
/*
* Records the superClass and supportedInterfaces relations,
* so that afterwards queries can be answered without resorting to typer.
@@ -419,10 +370,7 @@ abstract class BCodeTypes extends BCodeIdiomatic {
tr
}
- val EMPTY_TRACKED_SET = Set.empty[Tracked]
-
val EMPTY_TRACKED_ARRAY = Array.empty[Tracked]
- val EMPTY_InnerClassEntry_ARRAY = Array.empty[InnerClassEntry]
/*
* must-single-thread
@@ -461,12 +409,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
Tracked(key, flags, tsc, ifacesArr, innersChain)
}
- /* can-multi-thread */
- final def mkArray(xs: List[Tracked]): Array[Tracked] = {
- if (xs.isEmpty) { return EMPTY_TRACKED_ARRAY }
- val a = new Array[Tracked](xs.size); xs.copyToArray(a); a
- }
-
// ---------------- utilities around interfaces represented by Tracked instances. ----------------
/* Drop redundant interfaces (those which are implemented by some other).
@@ -497,21 +439,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
}
/*
- * Returns the intersection of two sets of interfaces.
- */
- def intersection(ifacesA: Set[Tracked], ifacesB: Set[Tracked]): Set[Tracked] = {
- var acc: Set[Tracked] = Set()
- for(ia <- ifacesA; ib <- ifacesB) {
- val ab = ia.supportedBranches(ib)
- val ba = ib.supportedBranches(ia)
- acc = minimizeInterfaces(acc ++ ab ++ ba)
- }
- checkAllInterfaces(acc)
-
- acc
- }
-
- /*
* Subtype check `a <:< b` on BTypes that takes into account the JVM built-in numeric promotions (e.g. BYTE to INT).
* Its operation can be visualized more easily in terms of the Java bytecode type hierarchy.
* This method used to be called, in the ICode world, TypeKind.<:<()
@@ -650,27 +577,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
}
/*
- * Whether the argument (the signature of a method) takes as argument
- * one ore more Function or PartialFunction (in particular an anonymous closure).
- *
- * can-multi-thread
- */
- final def isHigherOrderMethod(mtype: BType): Boolean = {
- assert(mtype.sort == BType.METHOD)
-
- val ats = mtype.getArgumentTypes
- var idx = 0
- while (idx < ats.length) {
- val t = ats(idx)
- if (isFunctionType(t) || isPartialFunctionType(t)) {
- return true
- }
- idx += 1
- }
- false
- }
-
- /*
* Whether the argument is a subtype of
* scala.PartialFunction[-A, +B] extends (A => B)
* N.B.: this method returns true for a scala.runtime.AbstractPartialFunction
@@ -682,16 +588,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
}
/*
- * Whether the argument is a subtype of
- * scala.runtime.AbstractPartialFunction[-T1, +R] extends Function1[T1, R] with PartialFunction[T1, R]
- *
- * can-multi-thread
- */
- def isAbstractPartialFunctionType(t: BType): Boolean = {
- (t.hasObjectSort) && exemplars.get(t).isSubtypeOf(AbstractPartialFunctionReference)
- }
-
- /*
* Whether the argument is a subtype of scala.FunctionX where 0 <= X <= definitions.MaxFunctionArity
*
* can-multi-thread
@@ -709,39 +605,6 @@ abstract class BCodeTypes extends BCodeIdiomatic {
false
}
- def isClosureClass(bt: BType): Boolean = {
- val tr = exemplars.get(bt); (tr != null && tr.isLambda)
- }
-
- /*
- * Whether the argument is a subtype of scala.runtime.AbstractFunctionX where 0 <= X <= definitions.MaxFunctionArity
- *
- * can-multi-thread
- */
- def isAbstractFunctionType(t: BType): Boolean = {
- if (!t.hasObjectSort) return false
- var idx = 0
- val et: Tracked = exemplars.get(t)
- while (idx <= definitions.MaxFunctionArity) {
- if (et.isSubtypeOf(AbstractFunctionReference(idx).c)) {
- return true
- }
- idx += 1
- }
- false
- }
-
- /*
- * For an argument of exactly one of the types
- * scala.runtime.AbstractFunctionX where 0 <= X <= definitions.MaxFunctionArity
- * returns the function arity, -1 otherwise.
- *
- * can-multi-thread
- */
- def abstractFunctionArity(t: BType): Int = {
- abstractFunctionArityMap.getOrElse(t, -1)
- }
-
/*
* must-single-thread
*/
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
index 181f4bde4e..fa424584b2 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
@@ -443,7 +443,6 @@ abstract class Inliners extends SubComponent {
case DontInlineHere(msg) => warnNoInline(msg)
case NeverSafeToInline => false
case InlineableAtThisCaller => true
- case inl @ FeasibleInline(_, _) if !inl.isSafe => false
case FeasibleInline(required, toPublicize) =>
for (f <- toPublicize) {
inlineLog("access", f, "making public")
@@ -738,16 +737,11 @@ abstract class Inliners extends SubComponent {
* - either log the reason for failure --- case (b) ---,
* - or perform inlining --- case (a) ---.
*/
- sealed abstract class InlineSafetyInfo {
- def isSafe = false
- }
+ sealed abstract class InlineSafetyInfo
case object NeverSafeToInline extends InlineSafetyInfo
- case object InlineableAtThisCaller extends InlineSafetyInfo { override def isSafe = true }
+ case object InlineableAtThisCaller extends InlineSafetyInfo
case class DontInlineHere(msg: String) extends InlineSafetyInfo
- case class FeasibleInline(accessNeeded: NonPublicRefs.Value,
- toBecomePublic: List[Symbol]) extends InlineSafetyInfo {
- override def isSafe = true
- }
+ case class FeasibleInline(accessNeeded: NonPublicRefs.Value, toBecomePublic: List[Symbol]) extends InlineSafetyInfo
case class AccessReq(
accessNeeded: NonPublicRefs.Value,
diff --git a/src/compiler/scala/tools/nsc/io/Socket.scala b/src/compiler/scala/tools/nsc/io/Socket.scala
index 4925c50d85..a803e4121a 100644
--- a/src/compiler/scala/tools/nsc/io/Socket.scala
+++ b/src/compiler/scala/tools/nsc/io/Socket.scala
@@ -9,18 +9,11 @@ package io
import java.io.{ IOException, InputStreamReader, BufferedReader, PrintWriter, Closeable }
import java.io.{ BufferedOutputStream, BufferedReader }
import java.net.{ ServerSocket, SocketException, SocketTimeoutException, InetAddress, Socket => JSocket }
-import scala.sys.SystemProperties._
import scala.io.Codec
/** A skeletal only-as-much-as-I-need Socket wrapper.
*/
object Socket {
- def preferringIPv4[T](body: => T): T = exclusively {
- val saved = preferIPv4Stack.value
- try { preferIPv4Stack.enable() ; body }
- finally preferIPv4Stack setValue saved
- }
-
class Box[+T](f: () => T) {
private def handlerFn[U](f: Throwable => U): PartialFunction[Throwable, U] = {
case x @ (_: IOException | _: SecurityException) => f(x)
diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
index 52c6ddc6ee..3f210a543c 100644
--- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
@@ -54,11 +54,6 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr
printMessage(pos, clabel(severity) + msg)
}
- def printSourceLine(pos: Position) {
- printMessage(pos.lineContent.stripLineEnd)
- printColumnMarker(pos)
- }
-
/** Prints the column marker of the given position.
*/
def printColumnMarker(pos: Position) =
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 96c93a838b..61b3d35f6a 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -165,7 +165,6 @@ trait ScalaSettings extends AbsScalaSettings
val Ygenjavap = StringSetting ("-Ygen-javap", "dir", "Generate a parallel output directory of .javap files.", "")
val Ygenasmp = StringSetting ("-Ygen-asmp", "dir", "Generate a parallel output directory of .asmp files (ie ASM Textifier output).", "")
val Ydumpclasses = StringSetting ("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "")
- val Ynosqueeze = BooleanSetting ("-Yno-squeeze", "Disable creation of compact code in matching.")
val Ystatistics = BooleanSetting ("-Ystatistics", "Print compiler statistics.") andThen (scala.reflect.internal.util.Statistics.enabled = _)
val stopAfter = PhasesSetting ("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat
val stopBefore = PhasesSetting ("-Ystop-before", "Stop before")
@@ -191,7 +190,6 @@ trait ScalaSettings extends AbsScalaSettings
val Yissuedebug = BooleanSetting("-Yissue-debug", "Print stack traces when a context issues an error.")
val YmacrodebugLite = BooleanSetting("-Ymacro-debug-lite", "Trace essential macro-related activities.")
val YmacrodebugVerbose = BooleanSetting("-Ymacro-debug-verbose", "Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions.")
- val Ypmatdebug = BooleanSetting("-Ypmat-debug", "Trace all pattern matcher activity.")
val Yposdebug = BooleanSetting("-Ypos-debug", "Trace position validation.")
val Yreifydebug = BooleanSetting("-Yreify-debug", "Trace reification.")
val Ytyperdebug = BooleanSetting("-Ytyper-debug", "Trace all type assignments.")
diff --git a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
index 6a405295cf..f001964fb4 100644
--- a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
@@ -288,7 +288,6 @@ abstract class ExtensionMethods extends Transform with TypingTransformers {
// object C { def meth$extension[M, C](this$: C[C], a: A)
// = { meth$extension[M', C']({ <expr>: C[C'] })(a1) } }
case treeInfo.Applied(sel @ Select(qual, _), targs, argss) if sel.symbol == origMeth =>
- import gen.CODE._
localTyper.typedPos(tree.pos) {
val allArgss = List(qual) :: argss
val origThis = extensionMeth.owner.companionClass
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index 7eb899d9d7..2a3c631a66 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -327,13 +327,7 @@ trait MatchApproximation extends TreeAndTypeAnalysis with ScalaLogic with MatchT
debug.patmat("treeMakers:")
debug.patmat(alignAcrossRows(cases, ">>"))
}
-
- def showTests(testss: List[List[Test]]) = {
- debug.patmat("tests: ")
- debug.patmat(alignAcrossRows(testss, "&"))
- }
}
-
}
trait MatchAnalysis extends MatchApproximation {
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala
index 8a04c67582..45698c0c76 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala
@@ -141,7 +141,7 @@ trait MatchOptimization extends MatchTreeMaking with MatchAnalysis {
object ReusedCondTreeMaker {
def apply(orig: CondTreeMaker) = new ReusedCondTreeMaker(orig.prevBinder, orig.nextBinder, orig.cond, orig.res, orig.pos)
}
- class ReusedCondTreeMaker(prevBinder: Symbol, val nextBinder: Symbol, cond: Tree, res: Tree, val pos: Position) extends TreeMaker { import CODE._
+ class ReusedCondTreeMaker(prevBinder: Symbol, val nextBinder: Symbol, cond: Tree, res: Tree, val pos: Position) extends TreeMaker {
lazy val localSubstitution = Substitution(List(prevBinder), List(CODE.REF(nextBinder)))
lazy val storedCond = freshSym(pos, BooleanTpe, "rc") setFlag MUTABLE
lazy val treesToHoist: List[Tree] = {
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
index ab19660da5..bb20c96809 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
@@ -53,10 +53,6 @@ trait MatchTranslation {
case TypeBound(tpe) => tpe
case tree => tree.tpe
}
- def repeatedType = unbound match {
- case Star(tpt) => tpt.tpe
- case _ => NoType
- }
def glbWith(other: Type) = glb(tpe :: other :: Nil).normalize
object SymbolAndTypeBound {
@@ -420,7 +416,6 @@ trait MatchTranslation {
)
private def rawGet = typeOfMemberNamedGetOrSelf(resultType)
- private def emptySub = rawSubPatTypes.isEmpty
private def rawInit = rawSubPatTypes dropRight 1
protected def sequenceType = typeOfLastSelectorOrSelf(rawGet)
protected def elementType = elementTypeOfLastSelectorOrSelf(rawGet)
@@ -651,12 +646,5 @@ trait MatchTranslation {
case _ => false
}
}
-
- object Bound {
- def unapply(t: Tree): Option[(Symbol, Tree)] = t match {
- case t@Bind(n, p) if t.hasExistingSymbol => Some((t.symbol, p)) // pos/t2429 does not satisfy these conditions
- case _ => None
- }
- }
}
}
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala
index 317685682d..7df03044aa 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala
@@ -159,7 +159,6 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging {
override def subPatternsAsSubstitution =
Substitution(subPatBinders, subPatRefs) >> super.subPatternsAsSubstitution
- import CODE._
def bindSubPats(in: Tree): Tree =
if (!emitVars) in
else {
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala b/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala
index a4944caa2b..394ba98f17 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala
@@ -106,7 +106,6 @@ trait Debugging {
trait Interface extends ast.TreeDSL {
import global._
- import definitions._
import analyzer.Typer
// 2.10/2.11 compatibility
@@ -117,7 +116,6 @@ trait Interface extends ast.TreeDSL {
object vpmName {
val one = newTermName("one")
- val drop = newTermName("drop")
val flatMap = newTermName("flatMap")
val get = newTermName("get")
val guard = newTermName("guard")
@@ -175,9 +173,6 @@ trait Interface extends ast.TreeDSL {
val matchOwner = typer.context.owner
def pureType(tp: Type): Type = tp
- // Extracting from the monad: tp == { def get: T }, result == T
- def matchMonadResult(tp: Type) = typeOfMemberNamedGet(tp)
-
def reportUnreachable(pos: Position) = typer.context.unit.warning(pos, "unreachable code")
def reportMissingCases(pos: Position, counterExamples: List[String]) = {
val ceString =
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index dc8c26c926..92f95e282b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -442,9 +442,6 @@ trait ContextErrors {
def ArrayConstantsTypeMismatchError(tree: Tree, pt: Type) =
NormalTypeError(tree, "found array constant, expected argument of type " + pt)
- def UnexpectedTreeAnnotation(tree: Tree) =
- NormalTypeError(tree, "unexpected tree in annotation: "+ tree)
-
def AnnotationTypeMismatchError(tree: Tree, expected: Type, found: Type) =
NormalTypeError(tree, "expected annotation of type " + expected + ", found " + found)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index b3675d6a82..4765c301dd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -854,9 +854,6 @@ object MacrosStats {
class Fingerprint private[Fingerprint](val value: Int) extends AnyVal {
def paramPos = { assert(isTag, this); value }
def isTag = value >= 0
- def isOther = this == Other
- def isExpr = this == LiftedTyped
- def isTree = this == LiftedUntyped
override def toString = this match {
case Other => "Other"
case LiftedTyped => "Expr"
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 12e8b0a3f9..599969598e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1675,13 +1675,6 @@ trait Namers extends MethodSynthesis {
}
}
- @deprecated("Use underlyingSymbol instead", "2.10.0")
- def underlying(member: Symbol): Symbol = underlyingSymbol(member)
- @deprecated("Use `companionSymbolOf` instead", "2.10.0")
- def companionClassOf(module: Symbol, ctx: Context): Symbol = companionSymbolOf(module, ctx)
- @deprecated("Use `companionSymbolOf` instead", "2.10.0")
- def companionModuleOf(clazz: Symbol, ctx: Context): Symbol = companionSymbolOf(clazz, ctx)
-
/** The companion class or companion module of `original`.
* Calling .companionModule does not work for classes defined inside methods.
*
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
index 38a3f18bf8..ee2a207efd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
@@ -159,19 +159,12 @@ trait PatternTypers {
}
}
- def newExtractorShape(tree: Tree): ExtractorShape = tree match {
- case Apply(fun, args) => ExtractorShape(fun, args)
- case UnApply(fun, args) => ExtractorShape(fun, args)
- }
def newExtractorShape(fun: Tree, args: List[Tree]): ExtractorShape = ExtractorShape(fun, args)
case class CaseClassInfo(clazz: Symbol, classType: Type) {
def constructor = clazz.primaryConstructor
def constructorType = classType.prefix memberType clazz memberType constructor
- def paramTypes = constructorType.paramTypes
def accessors = clazz.caseFieldAccessors
- def accessorTypes = accessors map (m => (classType memberType m).finalResultType)
- // def inverted = MethodType(clazz :: Nil, tupleType(accessorTypes))
}
object NoCaseClassInfo extends CaseClassInfo(NoSymbol, NoType) {
override def toString = "NoCaseClassInfo"
@@ -186,10 +179,7 @@ trait PatternTypers {
def paramType = firstParamType(unapplyType)
def rawGet = if (isBool) UnitTpe else typeOfMemberNamedGetOrSelf(resultType)
def rawTypes = if (isBool) Nil else typesOfSelectorsOrSelf(rawGet)
- def rawArity = rawTypes.size
def isBool = resultType =:= BooleanTpe // aka "Tuple0" or "Option[Unit]"
- def isNothing = rawGet =:= NothingTpe
- def isCase = method.isCase
}
object NoUnapplyMethodInfo extends UnapplyMethodInfo(NoSymbol, NoType) {
@@ -213,7 +203,6 @@ trait PatternTypers {
def unapplyMethod = exInfo.method
def unapplyType = exInfo.unapplyType
def unapplyParamType = exInfo.paramType
- def caseClass = ccInfo.clazz
def enclClass = symbol.enclClass
// TODO - merge these. The difference between these two methods is that expectedPatternTypes
diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
index bbd51b5564..54c665fe56 100644
--- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
@@ -62,15 +62,6 @@ trait StdAttachments {
}
}
- /** Checks whether there is any tree resulting from a macro expansion and associated with the current tree.
- */
- object ExpandedIntoTree {
- def unapply(tree: Tree): Option[Tree] = tree.attachments.get[MacroExpansionAttachment] match {
- case Some(MacroExpansionAttachment(_, tree: Tree)) => Some(tree)
- case _ => None
- }
- }
-
/** When present, suppresses macro expansion for the host.
* This is occasionally necessary, e.g. to prohibit eta-expansion of macros.
*
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 61295b5abd..f0252251f7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -157,7 +157,7 @@ trait SyntheticMethods extends ast.TreeDSL {
Ident(eqmeth.firstParam),
List(
CaseDef(Typed(Ident(nme.WILDCARD), TypeTree(clazz.tpe)), EmptyTree, TRUE),
- CaseDef(WILD.empty, EmptyTree, FALSE)
+ CaseDef(Ident(nme.WILDCARD), EmptyTree, FALSE)
)
)
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index e44c83aa56..1b726c37b9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -162,7 +162,6 @@ abstract class TreeCheckers extends Analyzer {
lazy val tpeOfTree = mutable.HashMap[Tree, Type]()
private lazy val reportedAlready = mutable.HashSet[(Tree, Symbol)]()
- def posstr(t: Tree): String = if (t eq null) "" else posstr(t.pos)
def posstr(p: Position): String = (
if (p eq null) "" else {
try p.source.path + ":" + p.line
@@ -264,9 +263,7 @@ abstract class TreeCheckers extends Analyzer {
checkedTyped(tree, mode, pt)
)
private def checkedTyped(tree: Tree, mode: Mode, pt: Type): Tree = {
- def tpe = try tree.tpe finally tree.clearType()
- val recorded = tpeOfTree.getOrElseUpdate(tree, tpe)
- val typed = wrap(tree)(super.typed(tree, mode, pt))
+ val typed = wrap(tree)(super.typed(tree, mode, pt))
if (tree ne typed)
treesDiffer(tree, typed)
@@ -365,8 +362,6 @@ abstract class TreeCheckers extends Analyzer {
def typeOf(t: Tree): Type = if (t.tpe eq null) NoType else t.tpe
def infoOf(t: Tree): Type = symbolOf(t).info
def referencesInType(tp: Type) = tp collect { case TypeRef(_, sym, _) => sym }
- def referencesInTree(t: Tree) = referencesInType(typeOf(t)) ++ referencesInType(infoOf(t))
- def symbolRefsInTree(t: Tree) = t collect { case t: RefTree => symbolOf(t) }
// Accessors are known to steal the type of the underlying field without cloning existential symbols at the new owner.
// This happens in Namer#accessorTypeCompleter. We just look the other way here.
if (symbolOf(tree).isAccessor)
@@ -381,10 +376,6 @@ abstract class TreeCheckers extends Analyzer {
sym.isTypeParameter
|| sym.isLocal
)
- val direct = tree match {
- case _: RefTree => treeSym
- case _ => NoSymbol
- }
val referencedSymbols = (treeSym :: referencesInType(treeInfo)).distinct filter (sym => isEligible(sym) && !isOk(sym))
def mk[T](what: String, x: T, str: T => String = (x: T) => "" + x): ((Any, String)) =
x -> s"%10s %-20s %s".format(what, classString(x), truncate(str(x), 80).trim)
@@ -415,13 +406,7 @@ abstract class TreeCheckers extends Analyzer {
}
referencedSymbols foreach (sym =>
- if (reportedAlready((tree, sym))) {
- def what = tree match {
- case tt: TypeTree => s"TypeTree(${tt.tpe})"
- case _ => tree.shortClass + "(" + tree.symbol.nameString + ")"
- }
- }
- else {
+ if (!reportedAlready((tree, sym))) {
errorFn("\n" + mkErrorMsg(sym))
reportedAlready += ((tree, sym))
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeStrings.scala b/src/compiler/scala/tools/nsc/typechecker/TypeStrings.scala
index afe6875218..cb1f1f4568 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeStrings.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeStrings.scala
@@ -112,11 +112,6 @@ trait StructuredTypeStrings extends DestructureTypes {
override def emptyTypeName = "Nil"
override def typeName = "List"
}
- class TypeScope(nodes: List[TypeNode]) extends TypeProduct(nodes) {
- override def grouping = BlockGrouping
- override def typeName = "Scope"
- override def emptyTypeName = "EmptyScope"
- }
object TypeEmpty extends TypeNode {
override def grouping = NoGrouping
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
index f44fd412fd..550fd4e68d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
@@ -9,14 +9,12 @@ package typechecker
import scala.collection.mutable
import scala.reflect.internal.util.{ BatchSourceFile, Statistics }
import mutable.ListBuffer
-import symtab.Flags._
import Mode._
trait TypersTracking {
self: Analyzer =>
import global._
- import definitions._
import typeDebug._
// To enable decent error messages when the typer crashes.
@@ -53,7 +51,6 @@ trait TypersTracking {
object typingStack {
val out = new java.io.PrintWriter(System.err, true)
- def println(msg: Any) = out println "" + msg
// TODO - account for colors so the color of a multiline string
// doesn't infect the connector lines
@@ -72,12 +69,7 @@ trait TypersTracking {
if (s1.length < 60 || settings.debug.value) s1 else s1.take(57) + "..."
}
- private val nextId = { var x = 1 ; () => try x finally x += 1 }
- private class Frame(val tree: Tree) {
- val stamp = System.nanoTime
- val id = nextId()
- }
- private object NoFrame extends Frame(EmptyTree) { }
+ private class Frame(val tree: Tree) { }
private def greenType(tp: Type): String = tpe_s(tp, inGreen)
private def greenType(tree: Tree): String = tree match {
case null => "[exception]"
@@ -108,7 +100,6 @@ trait TypersTracking {
showPush(tree, NOmode, WildcardType, context)
}
def showPush(tree: Tree, mode: Mode, pt: Type, context: Context) {
- val alreadyTyped = tree.tpe ne null
def tree_s = truncAndOneLine(ptTree(tree))
def pt_s = if (pt.isWildcard || context.inTypeConstructorAllowed) "" else s": pt=$pt"
def all_s = List(tree_s, pt_s, mode, fullSiteString(context)) filterNot (_ == "") mkString " "
@@ -143,9 +134,6 @@ trait TypersTracking {
def nextTyped(tree: Tree, mode: Mode, pt: Type, context: Context)(body: => Tree): Tree =
nextTypedInternal(tree, showPush(tree, mode, pt, context))(body)
- def nextTyped(tree: Tree, context: Context)(body: => Tree): Tree =
- nextTypedInternal(tree, showPush(tree, context))(body)
-
def nextTypedInternal(tree: Tree, pushFn: => Unit)(body: => Tree): Tree = (
if (noPrintTyping(tree))
body
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index c63d7f6820..8beca86a25 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -26,6 +26,8 @@ import scala.reflect.runtime.ReflectionUtils
* @author Stepan Koltsov
*/
object ClassPath {
+ import scala.language.postfixOps
+
/** Expand single path entry */
private def expandS(pattern: String): List[String] = {
val wildSuffix = File.separator + "*"
@@ -80,9 +82,6 @@ object ClassPath {
)
}
- /** A useful name filter. */
- def isTraitImplementation(name: String) = ReflectionUtils.isTraitImplementation(name)
-
def specToURL(spec: String): Option[URL] =
try Some(new URL(spec))
catch { case _: MalformedURLException => None }
diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala
index 72a4bbf5c0..0db351f918 100644
--- a/src/compiler/scala/tools/nsc/util/package.scala
+++ b/src/compiler/scala/tools/nsc/util/package.scala
@@ -10,9 +10,6 @@ package nsc
import java.io.{ OutputStream, PrintStream, ByteArrayOutputStream, PrintWriter, StringWriter }
package object util {
-
- implicit def postfixOps = scala.language.postfixOps // make all postfix ops in this package compile without warning
-
// forwarder for old code that builds against 2.9 and 2.10
val Chars = scala.reflect.internal.Chars
diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
index 6a495cfcee..fdc2613810 100644
--- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
+++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala
@@ -126,7 +126,9 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf =>
verify(expr0)
// need to wrap the expr, because otherwise you won't be able to typecheck macros against something that contains free vars
- var (expr, freeTerms) = extractFreeTerms(expr0, wrapFreeTermRefs = false)
+ val exprAndFreeTerms = extractFreeTerms(expr0, wrapFreeTermRefs = false)
+ var expr = exprAndFreeTerms._1
+ val freeTerms = exprAndFreeTerms._2
val dummies = freeTerms.map{ case (freeTerm, name) => ValDef(NoMods, name, TypeTree(freeTerm.info), Select(Ident(PredefModule), newTermName("$qmark$qmark$qmark"))) }.toList
expr = Block(dummies, wrapIntoTerm(expr))
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
index 9d171d52d2..dd849f2bca 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
@@ -60,11 +60,11 @@ trait Holes { self: Quasiquotes =>
}
object HoleType {
def unapply(tpe: Type): Option[HoleType] = tpe match {
- case NativeType(holeTpe) => Some(holeTpe)
- case LiftableType(holeTpe) => Some(holeTpe)
- case IterableTreeType(holeTpe) => Some(holeTpe)
+ case NativeType(holeTpe) => Some(holeTpe)
+ case LiftableType(holeTpe) => Some(holeTpe)
+ case IterableTreeType(holeTpe) => Some(holeTpe)
case IterableLiftableType(holeTpe) => Some(holeTpe)
- case _ => None
+ case _ => None
}
trait HoleTypeExtractor {
@@ -102,7 +102,7 @@ trait Holes { self: Quasiquotes =>
if (tree.tpe != null && (tree.tpe <:< listTreeType || tree.tpe <:< listListTreeType)) tree
else atPos(tree.pos)(loop(tree, n))
}
- val (card, elementTpe) = parseCardinality(tpe)
+ val card = parseCardinality(tpe)._1
if (card != NoDot) Some(reifyIterable(_, card)) else None
}
}
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Placeholders.scala b/src/compiler/scala/tools/reflect/quasiquotes/Placeholders.scala
index e20d98c0f1..c2b219ee31 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Placeholders.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Placeholders.scala
@@ -26,7 +26,7 @@ trait Placeholders { self: Quasiquotes =>
val start = sb.length
sb.append(value)
val end = sb.length
- posMap += pos -> (start, end)
+ posMap += pos -> ((start, end))
}
def appendHole(tree: Tree, cardinality: Cardinality) = {
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala
index 0d1fb6be07..18999e8267 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala
@@ -11,7 +11,6 @@ trait Reifiers { self: Quasiquotes =>
SyntacticDefDef, SyntacticValDef, SyntacticVarDef,
SyntacticBlock, SyntacticApplied, SyntacticTypeApplied,
SyntacticFunction, SyntacticNew, SyntacticAssign}
- import global.treeInfo._
import global.definitions._
import Cardinality._
import universeTypes._
diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala
index a0b42f248e..332d132ad0 100644
--- a/src/library/scala/collection/parallel/ParIterableLike.scala
+++ b/src/library/scala/collection/parallel/ParIterableLike.scala
@@ -587,6 +587,8 @@ self: ParIterableLike[T, Repr, Sequential] =>
}
}
+ def withFilter(pred: T => Boolean): Repr = filter(pred)
+
def filter(pred: T => Boolean): Repr = {
tasksupport.executeAndWaitResult(new Filter(pred, combinerFactory, splitter) mapResult { _.resultWithTaskSupport })
}
diff --git a/src/library/scala/runtime/Null$.scala b/src/library/scala/runtime/Null$.scala
index 1b7685c507..87ce0a2498 100644
--- a/src/library/scala/runtime/Null$.scala
+++ b/src/library/scala/runtime/Null$.scala
@@ -9,7 +9,6 @@
package scala
package runtime
-
/**
* Dummy class which exist only to satisfy the JVM. It corresponds to
* `scala.Null`. If such type appears in method signatures, it is erased
diff --git a/src/manual/scala/tools/docutil/EmitManPage.scala b/src/manual/scala/tools/docutil/EmitManPage.scala
index c30e847fee..21f1bf514a 100644
--- a/src/manual/scala/tools/docutil/EmitManPage.scala
+++ b/src/manual/scala/tools/docutil/EmitManPage.scala
@@ -110,8 +110,8 @@ object EmitManPage {
case lst:NumberedList =>
for {
idx <- List.range(0, lst.items.length)
- val item = lst.items(idx)
} {
+ val item = lst.items(idx)
out.println(".IP \" " + (idx+1) + ".\"")
emitText(item)
out.println
diff --git a/src/manual/scala/tools/docutil/ManPage.scala b/src/manual/scala/tools/docutil/ManPage.scala
index 2c5d696bed..853c17b94c 100644
--- a/src/manual/scala/tools/docutil/ManPage.scala
+++ b/src/manual/scala/tools/docutil/ManPage.scala
@@ -6,6 +6,8 @@
package scala.tools.docutil
+import scala.language.implicitConversions
+
object ManPage {
abstract class AbstractText {
def &(more: AbstractText) = SeqText(this, more)
diff --git a/src/reflect/scala/reflect/api/Quasiquotes.scala b/src/reflect/scala/reflect/api/Quasiquotes.scala
index 3895b8b95f..08d3274ca5 100644
--- a/src/reflect/scala/reflect/api/Quasiquotes.scala
+++ b/src/reflect/scala/reflect/api/Quasiquotes.scala
@@ -1,8 +1,6 @@
package scala.reflect
package api
-import language.experimental.macros
-
trait Quasiquotes { self: Universe =>
// implementation is hardwired to `dispatch` method of `scala.tools.reflect.quasiquotes.Quasiquotes`
diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala
index 25186ae95b..951efd90ed 100644
--- a/src/reflect/scala/reflect/internal/BuildUtils.scala
+++ b/src/reflect/scala/reflect/internal/BuildUtils.scala
@@ -83,7 +83,7 @@ trait BuildUtils { self: SymbolTable =>
def mkTparams(tparams: List[Tree]): List[TypeDef] =
tparams.map {
case td: TypeDef => copyTypeDef(td)(mods = (td.mods | PARAM) & (~DEFERRED))
- case other => throw new IllegalArgumentException("can't splice $other as type parameter")
+ case other => throw new IllegalArgumentException(s"can't splice $other as type parameter")
}
def mkRefineStat(stat: Tree): Tree = {
@@ -151,9 +151,9 @@ trait BuildUtils { self: SymbolTable =>
private object UnCtor {
def unapply(tree: Tree): Option[(Modifiers, List[List[ValDef]], List[Tree])] = tree match {
case DefDef(mods, nme.MIXIN_CONSTRUCTOR, _, _, _, Block(lvdefs, _)) =>
- Some(mods | Flag.TRAIT, Nil, lvdefs)
+ Some((mods | Flag.TRAIT, Nil, lvdefs))
case DefDef(mods, nme.CONSTRUCTOR, Nil, vparamss, _, Block(lvdefs :+ _, _)) =>
- Some(mods, vparamss, lvdefs)
+ Some((mods, vparamss, lvdefs))
case _ => None
}
}
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index 961e8e7264..7555df6775 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -334,9 +334,6 @@ trait Definitions extends api.StandardDefinitions {
lazy val ThrowableClass = getClassByName(sn.Throwable)
lazy val UninitializedErrorClass = requiredClass[UninitializedFieldError]
- @deprecated("Same effect but more compact: `throw null`. Details in JVM spec, `athrow` instruction.", "2.11.0")
- lazy val NPEConstructor = getMemberMethod(NullPointerExceptionClass, nme.CONSTRUCTOR) suchThat (_.paramss.flatten.isEmpty)
-
lazy val UninitializedFieldConstructor = UninitializedErrorClass.primaryConstructor
// fundamental reference classes
@@ -408,7 +405,6 @@ trait Definitions extends api.StandardDefinitions {
lazy val SerializableClass = requiredClass[scala.Serializable]
lazy val JavaSerializableClass = requiredClass[java.io.Serializable] modifyInfo fixupAsAnyTrait
lazy val ComparableClass = requiredClass[java.lang.Comparable[_]] modifyInfo fixupAsAnyTrait
- lazy val CloneableClass = requiredClass[scala.Cloneable]
lazy val JavaCloneableClass = requiredClass[java.lang.Cloneable]
lazy val JavaNumberClass = requiredClass[java.lang.Number]
lazy val RemoteInterfaceClass = requiredClass[java.rmi.Remote]
@@ -629,8 +625,6 @@ trait Definitions extends api.StandardDefinitions {
}
def isTupleSymbol(sym: Symbol) = TupleClass.seq contains unspecializedSymbol(sym)
- def isProductNClass(sym: Symbol) = ProductClass.seq contains sym
- def tupleField(n: Int, j: Int) = getMemberValue(TupleClass(n), nme.productAccessorName(j))
def isFunctionSymbol(sym: Symbol) = FunctionClass.seq contains unspecializedSymbol(sym)
def isProductNSymbol(sym: Symbol) = ProductClass.seq contains unspecializedSymbol(sym)
@@ -652,8 +646,6 @@ trait Definitions extends api.StandardDefinitions {
isNonTrivial && isMacroCompatible
}
- def isLiftableType(tp: Type) = tp <:< classExistentialType(LiftableClass)
-
def isIterableType(tp: Type) = tp <:< classExistentialType(IterableClass)
// These "direct" calls perform no dealiasing. They are most needed when
@@ -674,10 +666,6 @@ trait Definitions extends api.StandardDefinitions {
def Product_canEqual = getMemberMethod(ProductRootClass, nme.canEqual_)
def productProj(z:Symbol, j: Int): TermSymbol = getMemberValue(z, nme.productAccessorName(j))
- def productProj(n: Int, j: Int): TermSymbol = productProj(ProductClass(n), j)
-
- /** returns true if this type is exactly ProductN[T1,...,Tn], not some subclass */
- def isExactProductType(tp: Type): Boolean = isProductNSymbol(tp.typeSymbol)
/** if tpe <: ProductN[T1,...,TN], returns List(T1,...,TN) else Nil */
@deprecated("No longer used", "2.11.0") def getProductArgs(tpe: Type): List[Type] = tpe.baseClasses find isProductNSymbol match {
@@ -728,7 +716,6 @@ trait Definitions extends api.StandardDefinitions {
def byNameType(arg: Type) = appliedType(ByNameParamClass, arg)
def iteratorOfType(tp: Type) = appliedType(IteratorClass, tp)
def javaRepeatedType(arg: Type) = appliedType(JavaRepeatedParamClass, arg)
- def optionType(tp: Type) = appliedType(OptionClass, tp)
def scalaRepeatedType(arg: Type) = appliedType(RepeatedParamClass, arg)
def seqType(arg: Type) = appliedType(SeqClass, arg)
@@ -1073,12 +1060,6 @@ trait Definitions extends api.StandardDefinitions {
attr
}
- @deprecated("Moved to rootMirror.getClass", "2.10.0")
- def getClass(fullname: Name): ClassSymbol = rootMirror.getClassByName(fullname)
-
- @deprecated("Moved to rootMirror.getModule", "2.10.0")
- def getModule(fullname: Name): ModuleSymbol = rootMirror.getModule(fullname)
-
private def fatalMissingSymbol(owner: Symbol, name: Name, what: String = "member") = {
throw new FatalError(owner + " does not have a " + what + " " + name)
}
@@ -1289,25 +1270,16 @@ trait Definitions extends api.StandardDefinitions {
} //init
class UniverseDependentTypes(universe: Tree) {
- lazy val universeType = universe.tpe
- lazy val universeSym = universe.symbol
- lazy val nameType = universeMemberType(tpnme.Name)
- lazy val termNameType = universeMemberType(tpnme.TypeName)
- lazy val typeNameType = universeMemberType(tpnme.TermName)
- lazy val modsType = universeMemberType(tpnme.Modifiers)
- lazy val flagsType = universeMemberType(tpnme.FlagSet)
- lazy val symbolType = universeMemberType(tpnme.Symbol)
- lazy val treeType0 = universeMemberType(tpnme.Tree)
- lazy val treeType = universeMemberType(tpnme.Tree)
- lazy val typeDefType = universeMemberType(tpnme.TypeDef)
- lazy val caseDefType = universeMemberType(tpnme.CaseDef)
+ lazy val nameType = universeMemberType(tpnme.Name)
+ lazy val modsType = universeMemberType(tpnme.Modifiers)
+ lazy val flagsType = universeMemberType(tpnme.FlagSet)
+ lazy val symbolType = universeMemberType(tpnme.Symbol)
+ lazy val treeType = universeMemberType(tpnme.Tree)
+ lazy val caseDefType = universeMemberType(tpnme.CaseDef)
lazy val iterableTreeType = appliedType(IterableClass, treeType)
- lazy val iterableCaseDefType = appliedType(IterableClass, caseDefType)
- lazy val iterableIterableTreeType = appliedType(IterableClass, iterableTreeType)
- lazy val listTreeType = appliedType(ListClass, treeType)
+ lazy val listTreeType = appliedType(ListClass, treeType)
lazy val listListTreeType = appliedType(ListClass, listTreeType)
- lazy val optionTreeType = appliedType(OptionClass, treeType)
- lazy val optionNameType = appliedType(OptionClass, nameType)
+
def universeMemberType(name: TypeName) = universe.tpe.memberType(getTypeMember(universe.symbol, name))
}
}
diff --git a/src/reflect/scala/reflect/internal/HasFlags.scala b/src/reflect/scala/reflect/internal/HasFlags.scala
index f9fedc687d..ecbf839bab 100644
--- a/src/reflect/scala/reflect/internal/HasFlags.scala
+++ b/src/reflect/scala/reflect/internal/HasFlags.scala
@@ -164,12 +164,4 @@ trait HasFlags {
// Guess this can't be deprecated seeing as it's in the reflect API.
def isParameter = hasFlag(PARAM)
-
- // Backward compat section
- @deprecated( "Use isTrait", "2.10.0")
- def hasTraitFlag = hasFlag(TRAIT)
- @deprecated("Use flagString", "2.10.0")
- def defaultFlagString = flagString
- @deprecated("Use flagString(mask)", "2.10.0")
- def hasFlagsToString(mask: Long): String = flagString(mask)
}
diff --git a/src/reflect/scala/reflect/internal/Mode.scala b/src/reflect/scala/reflect/internal/Mode.scala
index 027e3a340a..557ec9c162 100644
--- a/src/reflect/scala/reflect/internal/Mode.scala
+++ b/src/reflect/scala/reflect/internal/Mode.scala
@@ -134,7 +134,6 @@ final class Mode private (val bits: Int) extends AnyVal {
def typingConstructorPattern = inAll(PATTERNmode | FUNmode)
def typingPatternNotConstructor = in(all = PATTERNmode, none = FUNmode)
def typingPatternOrTypePat = inAny(PATTERNmode | TYPEPATmode)
- def typingTypeByValue = inAll(TYPEmode | BYVALmode)
override def toString =
if (this == NOmode) "NOmode"
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index 4990596839..c1fd5b3cd6 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -91,7 +91,6 @@ trait StdNames {
val NAME_JOIN_STRING: String = NameTransformer.NAME_JOIN_STRING
val MODULE_SUFFIX_STRING: String = NameTransformer.MODULE_SUFFIX_STRING
- val SETTER_SUFFIX_STRING: String = NameTransformer.SETTER_SUFFIX_STRING
val LOCAL_SUFFIX_STRING: String = NameTransformer.LOCAL_SUFFIX_STRING
val TRAIT_SETTER_SEPARATOR_STRING: String = NameTransformer.TRAIT_SETTER_SEPARATOR_STRING
@@ -224,7 +223,6 @@ trait StdNames {
final val Nothing: NameType = "Nothing"
final val Null: NameType = "Null"
final val Object: NameType = "Object"
- final val Option: NameType = "Option"
final val PrefixType: NameType = "PrefixType"
final val Product: NameType = "Product"
final val Serializable: NameType = "Serializable"
@@ -245,8 +243,6 @@ trait StdNames {
final val Type : NameType = "Type"
final val TypeName: NameType = "TypeName"
final val TypeDef: NameType = "TypeDef"
- final val Tuple: NameType = "Tuple"
- final val Universe: NameType = "Universe"
final val Quasiquote: NameType = "Quasiquote"
// quasiquote-specific names
@@ -269,9 +265,7 @@ trait StdNames {
final val DeprecatedATTR: NameType = "Deprecated"
final val ExceptionsATTR: NameType = "Exceptions"
final val InnerClassesATTR: NameType = "InnerClasses"
- final val LocalVariableTableATTR: NameType = "LocalVariableTable"
final val RuntimeAnnotationATTR: NameType = "RuntimeVisibleAnnotations" // RetentionPolicy.RUNTIME
- final val RuntimeParamAnnotationATTR: NameType = "RuntimeVisibleParameterAnnotations" // RetentionPolicy.RUNTIME (annotations on parameters)
final val ScalaATTR: NameType = "Scala"
final val ScalaSignatureATTR: NameType = "ScalaSig"
final val SignatureATTR: NameType = "Signature"
@@ -401,11 +395,6 @@ trait StdNames {
name drop idx + 2
}
- @deprecated("Use SPECIALIZED_SUFFIX", "2.10.0")
- def SPECIALIZED_SUFFIX_STRING = SPECIALIZED_SUFFIX.toString
- @deprecated("Use SPECIALIZED_SUFFIX", "2.10.0")
- def SPECIALIZED_SUFFIX_NAME: TermName = SPECIALIZED_SUFFIX.toTermName
-
@deprecated("Use unexpandedName", "2.11.0") def originalName(name: Name): Name = unexpandedName(name)
@deprecated("Use Name#dropModule", "2.11.0") def stripModuleSuffix(name: Name): Name = name.dropModule
@deprecated("Use Name#dropLocal", "2.11.0") def localToGetter(name: TermName): TermName = name.dropLocal
@@ -576,13 +565,10 @@ trait StdNames {
val Annotation: NameType = "Annotation"
val Any: NameType = "Any"
val AnyVal: NameType = "AnyVal"
- val Apply: NameType = "Apply"
val ArrayAnnotArg: NameType = "ArrayAnnotArg"
- val Block: NameType = "Block"
val ConstantType: NameType = "ConstantType"
val EmptyPackage: NameType = "EmptyPackage"
val EmptyPackageClass: NameType = "EmptyPackageClass"
- val False : NameType = "False"
val Flag : NameType = "Flag"
val FlagsRepr: NameType = "FlagsRepr"
val Ident: NameType = "Ident"
@@ -591,7 +577,6 @@ trait StdNames {
val LiteralAnnotArg: NameType = "LiteralAnnotArg"
val Modifiers: NameType = "Modifiers"
val NestedAnnotArg: NameType = "NestedAnnotArg"
- val New: NameType = "New"
val NoFlags: NameType = "NoFlags"
val NoSymbol: NameType = "NoSymbol"
val NoMods: NameType = "NoMods"
@@ -619,7 +604,6 @@ trait StdNames {
val SyntacticVarDef: NameType = "SyntacticVarDef"
val This: NameType = "This"
val ThisType: NameType = "ThisType"
- val True : NameType = "True"
val Tuple2: NameType = "Tuple2"
val TYPE_ : NameType = "TYPE"
val TypeRef: NameType = "TypeRef"
@@ -648,12 +632,10 @@ trait StdNames {
val bytes: NameType = "bytes"
val c: NameType = "c"
val canEqual_ : NameType = "canEqual"
- val checkInitialized: NameType = "checkInitialized"
val classOf: NameType = "classOf"
val clone_ : NameType = "clone"
val collection: NameType = "collection"
val conforms: NameType = "conforms"
- val compare: NameType = "compare"
val copy: NameType = "copy"
val create: NameType = "create"
val currentMirror: NameType = "currentMirror"
@@ -678,8 +660,6 @@ trait StdNames {
val finalize_ : NameType = "finalize"
val find_ : NameType = "find"
val flatMap: NameType = "flatMap"
- val flatten: NameType = "flatten"
- val foldLeft: NameType = "foldLeft"
val foreach: NameType = "foreach"
val get: NameType = "get"
val hashCode_ : NameType = "hashCode"
@@ -691,7 +671,6 @@ trait StdNames {
val inlinedEquals: NameType = "inlinedEquals"
val isArray: NameType = "isArray"
val isDefinedAt: NameType = "isDefinedAt"
- val isEmpty: NameType = "isEmpty"
val isInstanceOf_ : NameType = "isInstanceOf"
val isInstanceOf_Ob : NameType = "$isInstanceOf"
val java: NameType = "java"
@@ -716,8 +695,6 @@ trait StdNames {
val newFreeType: NameType = "newFreeType"
val newNestedSymbol: NameType = "newNestedSymbol"
val newScopeWith: NameType = "newScopeWith"
- val nmeCONSTRUCTOR: NameType = "CONSTRUCTOR"
- val nmeNme: NameType = "nme"
val notifyAll_ : NameType = "notifyAll"
val notify_ : NameType = "notify"
val null_ : NameType = "null"
@@ -756,7 +733,6 @@ trait StdNames {
val toArray: NameType = "toArray"
val toList: NameType = "toList"
val toObjectArray : NameType = "toObjectArray"
- val toSeq: NameType = "toSeq"
val TopScope: NameType = "TopScope"
val toString_ : NameType = "toString"
val toTypeConstructor: NameType = "toTypeConstructor"
@@ -776,7 +752,6 @@ trait StdNames {
val value: NameType = "value"
val valueOf : NameType = "valueOf"
val values : NameType = "values"
- val view_ : NameType = "view"
val wait_ : NameType = "wait"
val withFilter: NameType = "withFilter"
val zero: NameType = "zero"
@@ -1012,15 +987,9 @@ trait StdNames {
val isBoxedNumber: NameType = "isBoxedNumber"
val reflPolyCacheName: NameType = "reflPoly$Cache"
- val reflClassCacheName: NameType = "reflClass$Cache"
val reflParamsCacheName: NameType = "reflParams$Cache"
- val reflMethodCacheName: NameType = "reflMethod$Cache"
val reflMethodName: NameType = "reflMethod$Method"
- @deprecated("Use a method in tpnme", "2.10.0") def dropSingletonName(name: Name): TypeName = tpnme.dropSingletonName(name)
- @deprecated("Use a method in tpnme", "2.10.0") def singletonName(name: Name): TypeName = tpnme.singletonName(name)
- @deprecated("Use a method in tpnme", "2.10.0") def implClassName(name: Name): TypeName = tpnme.implClassName(name)
- @deprecated("Use a method in tpnme", "2.10.0") def interfaceName(implname: Name): TypeName = tpnme.interfaceName(implname)
}
class JavaKeywords {
@@ -1106,7 +1075,6 @@ trait StdNames {
final val GetClassLoader: TermName = newTermName("getClassLoader")
final val GetMethod: TermName = newTermName("getMethod")
final val Invoke: TermName = newTermName("invoke")
- final val JavaLang: TermName = newTermName("java.lang")
val Boxed = immutable.Map[TypeName, TypeName](
tpnme.Boolean -> BoxedBoolean,
diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala
index 9be1768289..e44461f964 100644
--- a/src/reflect/scala/reflect/internal/TreeGen.scala
+++ b/src/reflect/scala/reflect/internal/TreeGen.scala
@@ -209,8 +209,7 @@ abstract class TreeGen extends macros.TreeBuilder {
/** Builds a type application node if args.nonEmpty, returns fun otherwise. */
def mkTypeApply(fun: Tree, targs: List[Tree]): Tree =
if (targs.isEmpty) fun else TypeApply(fun, targs)
- def mkTypeApply(target: Tree, method: Symbol, targs: List[Type]): Tree =
- mkTypeApply(Select(target, method), targs map TypeTree)
+
def mkAttributedTypeApply(target: Tree, method: Symbol, targs: List[Type]): Tree =
mkTypeApply(mkAttributedSelect(target, method), targs map TypeTree)
@@ -298,10 +297,6 @@ abstract class TreeGen extends macros.TreeBuilder {
mkAttributedRef(ReflectRuntimeUniverse) setType singleType(ReflectRuntimeUniverse.owner.thisPrefix, ReflectRuntimeUniverse)
}
- def mkPackageDef(packageName: String, stats: List[Tree]): PackageDef = {
- PackageDef(mkUnattributedRef(newTermName(packageName)), stats)
- }
-
def mkSeqApply(arg: Tree): Apply = {
val factory = Select(gen.mkAttributedRef(SeqModule), nme.apply)
Apply(factory, List(arg))
@@ -362,7 +357,6 @@ abstract class TreeGen extends macros.TreeBuilder {
// convert (implicit ... ) to ()(implicit ... ) if its the only parameter section
if (vparamss1.isEmpty || !vparamss1.head.isEmpty && vparamss1.head.head.mods.isImplicit)
vparamss1 = List() :: vparamss1
- val superRef: Tree = atPos(superPos)(mkSuperInitCall)
val superCall = pendingSuperCall // we can't know in advance which of the parents will end up as a superclass
// this requires knowing which of the parents is a type macro and which is not
// and that's something that cannot be found out before typer
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala
index 2f70b1950d..025965ad47 100644
--- a/src/reflect/scala/reflect/internal/TreeInfo.scala
+++ b/src/reflect/scala/reflect/internal/TreeInfo.scala
@@ -430,11 +430,6 @@ abstract class TreeInfo {
case _ => false
}
- def isEarlyTypeDef(tree: Tree) = tree match {
- case TypeDef(mods, _, _, _) => mods hasFlag PRESUPER
- case _ => false
- }
-
/** Is tpt a vararg type of the form T* ? */
def isRepeatedParamType(tpt: Tree) = tpt match {
case TypeTree() => definitions.isRepeatedParamType(tpt.tpe)
@@ -529,21 +524,6 @@ abstract class TreeInfo {
private def hasNoSymbol(t: Tree) = t.symbol == null || t.symbol == NoSymbol
- /** If this CaseDef assigns a name to its top-level pattern,
- * in the form 'expr @ pattern' or 'expr: pattern', returns
- * the name. Otherwise, nme.NO_NAME.
- *
- * Note: in the case of Constant patterns such as 'case x @ "" =>',
- * the pattern matcher eliminates the binding and inlines the constant,
- * so as far as this method is likely to be able to determine,
- * the name is NO_NAME.
- */
- def assignedNameOfPattern(cdef: CaseDef): Name = cdef.pat match {
- case Bind(name, _) => name
- case Ident(name) => name
- case _ => nme.NO_NAME
- }
-
/** Is this pattern node a synthetic catch-all case, added during PartialFuction synthesis before we know
* whether the user provided cases are exhaustive. */
def isSyntheticDefaultCase(cdef: CaseDef) = cdef match {
@@ -729,25 +709,6 @@ abstract class TreeInfo {
}
loop(tree)
}
-
- /** The depth of the nested applies: e.g. Apply(Apply(Apply(_, _), _), _)
- * has depth 3. Continues through type applications (without counting them.)
- */
- def applyDepth: Int = {
- def loop(tree: Tree): Int = tree match {
- case Apply(fn, _) => 1 + loop(fn)
- case TypeApply(fn, _) => loop(fn)
- case AppliedTypeTree(fn, _) => loop(fn)
- case _ => 0
- }
- loop(tree)
- }
-
- override def toString = {
- val tstr = if (targs.isEmpty) "" else targs.mkString("[", ", ", "]")
- val astr = argss map (args => args.mkString("(", ", ", ")")) mkString ""
- s"$core$tstr$astr"
- }
}
/** Returns a wrapper that knows how to destructure and analyze applications.
@@ -835,12 +796,6 @@ abstract class TreeInfo {
case _ => false
}
}
- object IsIf extends SeeThroughBlocks[Option[(Tree, Tree, Tree)]] {
- protected def unapplyImpl(x: Tree) = x match {
- case If(cond, thenp, elsep) => Some((cond, thenp, elsep))
- case _ => None
- }
- }
def isApplyDynamicName(name: Name) = (name == nme.updateDynamic) || (name == nme.selectDynamic) || (name == nme.applyDynamic) || (name == nme.applyDynamicNamed)
@@ -893,7 +848,4 @@ abstract class TreeInfo {
case Block(_, expr) => isMacroApplicationOrBlock(expr)
case tree => isMacroApplication(tree)
}
-
- def isNonTrivialMacroApplication(tree: Tree): Boolean =
- isMacroApplication(tree) && dissectApplied(tree).core != tree
}
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 96907d484a..ccf5cf5249 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -182,9 +182,6 @@ trait Trees extends api.Trees { self: SymbolTable =>
override def substituteThis(clazz: Symbol, to: Tree): Tree =
new ThisSubstituter(clazz, to) transform this
- def replace(from: Tree, to: Tree): Tree =
- new TreeReplacer(from, to, positionAware = false) transform this
-
def hasExistingSymbol = (symbol ne null) && (symbol ne NoSymbol)
def hasSymbolWhich(f: Symbol => Boolean) = hasExistingSymbol && f(symbol)
@@ -1399,9 +1396,6 @@ trait Trees extends api.Trees { self: SymbolTable =>
// --- specific traversers and transformers
- @deprecated("Moved to tree.duplicate", "2.10.0")
- protected[scala] def duplicateTree(tree: Tree): Tree = tree.duplicate
-
class ForeachPartialTreeTraverser(pf: PartialFunction[Tree, Tree]) extends Traverser {
override def traverse(tree: Tree) {
val t = if (pf isDefinedAt tree) pf(tree) else tree
diff --git a/src/reflect/scala/reflect/internal/TypeDebugging.scala b/src/reflect/scala/reflect/internal/TypeDebugging.scala
index b70d3bd970..63f897cd32 100644
--- a/src/reflect/scala/reflect/internal/TypeDebugging.scala
+++ b/src/reflect/scala/reflect/internal/TypeDebugging.scala
@@ -113,7 +113,7 @@ trait TypeDebugging {
case _ => "" + t.symbol.tpe
}
def ptTypeParam(td: TypeDef): String = {
- val TypeDef(mods, name, tparams, rhs) = td
+ val TypeDef(_, name, tparams, rhs) = td
name + ptTypeParams(tparams) + ptTree(rhs)
}
def ptTypeParams(tparams: List[TypeDef]): String = str brackets (tparams map ptTypeParam)
@@ -147,6 +147,5 @@ trait TypeDebugging {
}
def paramString(tp: Type) = typeDebug.str parentheses (tp.params map (_.defString))
def typeParamsString(tp: Type) = typeDebug.str brackets (tp.typeParams map (_.defString))
- def typeArgsString(tp: Type) = typeDebug.str brackets (tp.typeArgs map (_.safeToString))
def debugString(tp: Type) = typeDebug debugString tp
}
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 77f4b1b70c..4367e51041 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -537,8 +537,6 @@ trait Types
else Nil
)
- def etaExpand: Type = this
-
/** Performs a single step of beta-reduction on types.
* Given:
*
@@ -2309,7 +2307,7 @@ trait Types
|| pre.isGround && args.forall(_.isGround)
)
- override def etaExpand: Type = {
+ def etaExpand: Type = {
// must initialise symbol, see test/files/pos/ticket0137.scala
val tpars = initializedTypeParams
if (tpars.isEmpty) this
@@ -2443,7 +2441,8 @@ trait Types
else
super.prefixString
)
- def copy(pre: Type = this.pre, sym: Symbol = this.sym, args: List[Type] = this.args) = TypeRef(pre, sym, args)
+ // Suppressing case class copy method which risks subverting our single point of creation.
+ private def copy = null
override def kind = "TypeRef"
}
@@ -4596,9 +4595,6 @@ trait Types
case _ => Depth(1)
}
- def withUncheckedVariance(tp: Type): Type =
- tp withAnnotation (AnnotationInfo marker uncheckedVarianceClass.tpe)
-
//OPT replaced with tailrecursive function to save on #closures
// was:
// var d = 0
diff --git a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala
index d6310c8cec..7e98ac03d5 100644
--- a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala
+++ b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala
@@ -973,22 +973,6 @@ private[internal] trait TypeMaps {
}
}
- /** A map to implement the `contains` method. */
- class ContainsTypeCollector(t: Type) extends TypeCollector(false) {
- def traverse(tp: Type) {
- if (!result) {
- if (tp eq t) result = true
- else mapOver(tp)
- }
- }
- override def mapOver(arg: Tree) = {
- for (t <- arg)
- traverse(t.tpe)
-
- arg
- }
- }
-
/** A map to implement the `filter` method. */
class FilterTypeCollector(p: Type => Boolean) extends TypeCollector[List[Type]](Nil) {
override def collect(tp: Type) = super.collect(tp).reverse
diff --git a/src/reflect/scala/reflect/internal/transform/Erasure.scala b/src/reflect/scala/reflect/internal/transform/Erasure.scala
index 90ffe9d9e7..185e2c3d1e 100644
--- a/src/reflect/scala/reflect/internal/transform/Erasure.scala
+++ b/src/reflect/scala/reflect/internal/transform/Erasure.scala
@@ -77,11 +77,6 @@ trait Erasure {
if (cls.owner.isClass) cls.owner.tpe_* else pre // why not cls.isNestedClass?
}
- def unboxDerivedValueClassMethod(clazz: Symbol): Symbol =
- (clazz.info.decl(nme.unbox)) orElse
- (clazz.info.decls.find(_ hasAllFlags PARAMACCESSOR | METHOD) getOrElse
- NoSymbol)
-
def underlyingOfValueClass(clazz: Symbol): Type =
clazz.derivedValueClassUnbox.tpe.resultType
diff --git a/src/reflect/scala/reflect/internal/util/SourceFile.scala b/src/reflect/scala/reflect/internal/util/SourceFile.scala
index f36c50bff1..3b6c57e955 100644
--- a/src/reflect/scala/reflect/internal/util/SourceFile.scala
+++ b/src/reflect/scala/reflect/internal/util/SourceFile.scala
@@ -34,7 +34,6 @@ abstract class SourceFile {
*/
def positionInUltimateSource(position: Position) = position
override def toString() = file.name
- def dbg(offset: Int) = Position.offset(this, offset).toString
def path = file.path
def lineToString(index: Int): String =
diff --git a/src/reflect/scala/reflect/internal/util/TableDef.scala b/src/reflect/scala/reflect/internal/util/TableDef.scala
index e97aa662d8..8708442c85 100644
--- a/src/reflect/scala/reflect/internal/util/TableDef.scala
+++ b/src/reflect/scala/reflect/internal/util/TableDef.scala
@@ -14,23 +14,14 @@ class TableDef[T](_cols: Column[T]*) {
// These operators are about all there is to it.
/** Appends a column to the table. */
def ~(next: Column[T]) = retThis(cols :+= next)
- /** Creates a right-justified column and appends it. */
- def >>(pair: (String, T => Any)) = this ~ Column(pair._1, pair._2, left = false)
- /** Creates a left-justified column and appends it. */
- def <<(pair: (String, T => Any)) = this ~ Column(pair._1, pair._2, left = true)
- /** Specifies a string to separate the previous column from the next.
- * If none is specified, a space is used. */
- def >+(sep: String) = retThis(separators += ((cols.size - 1, sep)))
// Below this point should all be considered private/internal.
private var cols: List[Column[T]] = _cols.toList
- private var separators: Map[Int, String] = Map()
- def defaultSep(index: Int) = if (index > (cols.size - 2)) "" else " "
- def sepAfter(i: Int): String = separators.getOrElse(i, defaultSep(i))
- def sepWidths = cols.indices map (i => sepAfter(i).length)
+ def defaultSep(index: Int) = if (index > (cols.size - 2)) "" else " "
+ def sepAfter(i: Int): String = defaultSep(i)
+ def sepWidths = cols.indices map (i => sepAfter(i).length)
- def columns = cols
def colNames = cols map (_.name)
def colFunctions = cols map (_.f)
def colApply(el: T) = colFunctions map (f => f(el))
@@ -57,8 +48,6 @@ class TableDef[T](_cols: Column[T]*) {
def mkFormatString(sepf: Int => String): String =
specs.zipWithIndex map { case (c, i) => c + sepf(i) } mkString
- def pp(): Unit = allToSeq foreach println
-
def toFormattedSeq = argLists map (xs => rowFormat.format(xs: _*))
def allToSeq = headers ++ toFormattedSeq
diff --git a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala
index a8bc79d832..a9a7c7780d 100644
--- a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala
+++ b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala
@@ -384,31 +384,6 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D
* Number of buckets in the table
*/
def bucketsCount: Int = table.size
-
- /**
- * Number of buckets that don't hold anything
- */
- def emptyBucketsCount = bucketsCount - fullBucketsCount
-
- /**
- * Number of elements that are in collision. Useful for diagnosing performance issues.
- */
- def collisionsCount = size - (fullBucketsCount - collisionBucketsCount)
-
- /**
- * A map from a count of elements to the number of buckets with that count
- */
- def elementCountDistribution = table map linkedListSize groupBy identity map {case (size, list) => (size, list.size)}
-
- private def linkedListSize(entry: Entry[A]) = {
- var e = entry
- var count = 0
- while (e != null) {
- count += 1
- e = e.tail
- }
- count
- }
}
private[util] def diagnostics = new Diagnostics
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index fe5d9c4576..1a15454500 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -431,8 +431,8 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
case sym if isGetClass(sym) => preciseClass(receiver)
case Any_asInstanceOf => fail("Any.asInstanceOf requires a type argument")
case Any_isInstanceOf => fail("Any.isInstanceOf requires a type argument")
- case Object_asInstanceOf => fail("AnyRef.$asInstanceOf is an internal method")
- case Object_isInstanceOf => fail("AnyRef.$isInstanceOf is an internal method")
+ case Object_asInstanceOf => fail("AnyRef.%s is an internal method" format symbol.name)
+ case Object_isInstanceOf => fail("AnyRef.%s is an internal method" format symbol.name)
case Array_length => ScalaRunTime.array_length(objReceiver)
case Array_apply => ScalaRunTime.array_apply(objReceiver, args(0).asInstanceOf[Int])
case Array_update => ScalaRunTime.array_update(objReceiver, args(0).asInstanceOf[Int], args(1))
@@ -467,7 +467,6 @@ private[reflect] trait JavaMirrors extends internal.SymbolTable with api.JavaUni
extends TemplateMirror {
def outer: AnyRef
def erasure: ClassSymbol
- lazy val signature = typeToScala(classToJava(erasure))
}
private class JavaClassMirror(val outer: AnyRef, val symbol: ClassSymbol)
diff --git a/src/reflect/scala/reflect/runtime/Settings.scala b/src/reflect/scala/reflect/runtime/Settings.scala
index a14eafff24..d65e9329ed 100644
--- a/src/reflect/scala/reflect/runtime/Settings.scala
+++ b/src/reflect/scala/reflect/runtime/Settings.scala
@@ -38,7 +38,6 @@ private[reflect] class Settings extends MutableSettings {
val Yposdebug = new BooleanSetting(false)
val Yrangepos = new BooleanSetting(false)
val debug = new BooleanSetting(false)
- val deepCloning = new BooleanSetting(false)
val explaintypes = new BooleanSetting(false)
val overrideObjects = new BooleanSetting(false)
val printtypes = new BooleanSetting(false)
diff --git a/src/reflect/scala/reflect/runtime/TwoWayCache.scala b/src/reflect/scala/reflect/runtime/TwoWayCache.scala
index 181ca6014a..d0fc3dac74 100644
--- a/src/reflect/scala/reflect/runtime/TwoWayCache.scala
+++ b/src/reflect/scala/reflect/runtime/TwoWayCache.scala
@@ -52,16 +52,4 @@ private[runtime] class TwoWayCache[J, S] {
result
}
}
-
- def toJavaOption(key: S)(body: => Option[J]): Option[J] = synchronized {
- toJavaMap get key match {
- case SomeRef(v) =>
- Some(v)
- case _ =>
- val result = body
- for (value <- result) enter(value, key)
- result
- }
- }
}
-
diff --git a/src/repl/scala/tools/nsc/interpreter/ByteCode.scala b/src/repl/scala/tools/nsc/interpreter/ByteCode.scala
deleted file mode 100644
index e1e3678837..0000000000
--- a/src/repl/scala/tools/nsc/interpreter/ByteCode.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-import java.lang.reflect
-import util.ScalaClassLoader
-import ScalaClassLoader.appLoader
-import scala.reflect.NameTransformer._
-
-object ByteCode {
- /** Until I figure out why I can't get scalap onto the classpath such
- * that the compiler will bootstrap, we have to use reflection.
- */
- private lazy val DECODER: Option[AnyRef] =
- for (clazz <- appLoader.tryToLoadClass[AnyRef]("scala.tools.scalap.Decode$")) yield
- clazz.getField(MODULE_INSTANCE_NAME).get(null)
-
- private def decoderMethod(name: String, args: JClass*): Option[reflect.Method] = {
- for (decoder <- DECODER ; m <- Option(decoder.getClass.getMethod(name, args: _*))) yield m
- }
-
- private lazy val aliasMap = {
- for (module <- DECODER ; method <- decoderMethod("typeAliases", classOf[String])) yield
- method.invoke(module, _: String).asInstanceOf[Option[Map[String, String]]]
- }
-
- def aliasesForPackage(pkg: String) = aliasMap flatMap (_(pkg))
-}
diff --git a/src/repl/scala/tools/nsc/interpreter/Completion.scala b/src/repl/scala/tools/nsc/interpreter/Completion.scala
index 84a5cb49ae..9ad7f95fae 100644
--- a/src/repl/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Completion.scala
@@ -12,12 +12,10 @@ import Completion._
* reference to the jline classes.
*/
trait Completion {
- type ExecResult
def resetVerbosity(): Unit
def completer(): ScalaCompleter
}
object NoCompletion extends Completion {
- type ExecResult = Nothing
def resetVerbosity() = ()
def completer() = NullCompleter
}
diff --git a/src/repl/scala/tools/nsc/interpreter/ExprTyper.scala b/src/repl/scala/tools/nsc/interpreter/ExprTyper.scala
index bb5fe07fc9..8a6a405810 100644
--- a/src/repl/scala/tools/nsc/interpreter/ExprTyper.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ExprTyper.scala
@@ -13,7 +13,6 @@ trait ExprTyper {
import repl._
import global.{ reporter => _, Import => _, _ }
- import syntaxAnalyzer.UnitParser
import naming.freshInternalVarName
def symbolOfLine(code: String): Symbol = {
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index 984a752964..217414809e 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -23,7 +23,6 @@ import scala.collection.generic.Clearable
import scala.concurrent.{ ExecutionContext, Await, Future, future }
import ExecutionContext.Implicits._
import java.io.{ BufferedReader, FileReader }
-import scala.reflect.internal.util.StringOps._
/** The Scala interactive shell. It provides a read-eval-print loop
* around the Interpreter class.
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index 7e8999a099..e4a3416152 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -861,15 +861,7 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set
def path = originalPath("$intp")
def envLines = {
if (!isReplPower) Nil // power mode only for now
- // $intp is not bound; punt, but include the line.
- else if (path == "$intp") List(
- "def $line = " + tquoted(originalLine),
- "def $trees = Nil"
- )
- else List(
- "def $line = " + tquoted(originalLine),
- "def $trees = Nil"
- )
+ else List("def %s = %s".format("$line", tquoted(originalLine)), "def %s = Nil".format("$trees"))
}
val preamble = """
diff --git a/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala
index 61db8d1748..1b3d60d41a 100644
--- a/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala
+++ b/src/repl/scala/tools/nsc/interpreter/JLineCompletion.scala
@@ -17,7 +17,6 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput
import global._
import definitions._
import rootMirror.{ RootClass, getModuleIfDefined }
- type ExecResult = Any
import intp.{ debugging }
// verbosity goes up with consecutive tabs
diff --git a/src/repl/scala/tools/nsc/interpreter/ReplStrings.scala b/src/repl/scala/tools/nsc/interpreter/ReplStrings.scala
index 08472bbc64..43da5c6f12 100644
--- a/src/repl/scala/tools/nsc/interpreter/ReplStrings.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ReplStrings.scala
@@ -28,5 +28,5 @@ trait ReplStrings {
def any2stringOf(x: Any, maxlen: Int) =
"scala.runtime.ScalaRunTime.replStringOf(%s, %s)".format(x, maxlen)
- def words(s: String) = s.trim split "\\s+" filterNot (_ == "") toList
+ def words(s: String) = (s.trim split "\\s+" filterNot (_ == "")).toList
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala b/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
index e654678c6d..2ea3a0eb7c 100644
--- a/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
@@ -7,7 +7,6 @@ package scala.tools.nsc
package doc
import scala.tools.nsc.ast.parser.{ SyntaxAnalyzer, BracePatch }
-import symtab._
import reporters.Reporter
import typechecker.Analyzer
import scala.reflect.internal.util.{ BatchSourceFile, RangePosition }
diff --git a/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala
index 4e06e5bd16..fe157c1cc9 100644
--- a/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/model/CommentFactory.scala
@@ -9,10 +9,8 @@ package model
import base.comment._
-import reporters.Reporter
import scala.collection._
-import scala.reflect.internal.util.{NoPosition, Position}
-import scala.language.postfixOps
+import scala.reflect.internal.util.Position
/** The comment parser transforms raw comment strings into `Comment` objects.
* Call `parse` to run the parser. Note that the parser is stateless and
@@ -24,7 +22,7 @@ trait CommentFactory extends base.CommentFactoryBase {
thisFactory: ModelFactory with CommentFactory with MemberLookup =>
val global: Global
- import global.{ reporter, definitions, Symbol, NoSymbol }
+ import global.{ Symbol, NoSymbol }
protected val commentCache = mutable.HashMap.empty[(Symbol, DocTemplateImpl), Option[Comment]]
@@ -83,7 +81,7 @@ trait CommentFactory extends base.CommentFactoryBase {
}
protected def parse(comment: String, src: String, pos: Position, linkTarget: DocTemplateImpl): Comment = {
- val sym = if (linkTarget eq null) NoSymbol else linkTarget.sym
+ val sym = if (linkTarget eq null) NoSymbol else linkTarget.sym
parseAtSymbol(comment, src, pos, sym)
}
@@ -94,7 +92,7 @@ trait CommentFactory extends base.CommentFactoryBase {
* - Removed all end-of-line whitespace.
* - Only `endOfLine` is used to mark line endings. */
def parseWiki(string: String, pos: Position, inTpl: DocTemplateImpl): Body = {
- val sym = if (inTpl eq null) NoSymbol else inTpl.sym
+ val sym = if (inTpl eq null) NoSymbol else inTpl.sym
parseWikiAtSymbol(string,pos, sym)
}
}