From d4546fd74f94c653200200ef09cbbf2e1a808668 Mon Sep 17 00:00:00 2001 From: EECOLOR Date: Thu, 15 Jan 2015 22:43:04 +0100 Subject: Removed warnings - Added `since` to deprecation statement - Added unit to parameter list - Removed usage of deprecated method polyType - Replaced deprecated `debugwarn` with `devWarning` - Changed switch statement to if else in order to remove a warning - Switched implementation of `init` and `processOptions` to prevent warning - Replaced deprecated `Console.readLine` with `scala.io.StdIn.readLine` - Replaced deprecated `startOrPoint` with `start` - Replaced deprecated `tpe_=` with `setType` - Replaced deprecated `typeCheck` with `typecheck` - Replaced deprecated `CompilationUnit.warning` with `typer.context.warning` - Replaced deprecated `scala.tools.nsc.util.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader` - Replaced deprecated `scala.tools.ListOfNil` with `scala.reflect.internal.util.ListOfNil` - Replaced deprecated `scala.tools.utils.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader` - Replaced deprecated `emptyValDef` with `noSelfType` - In `BoxesRunTime` removed unused method and commented out unused values. Did not delete to keep a reference to the values. If they are deleted people might wonder why `1` and `2` are not used. - Replaced deprecated `scala.tools.nsc.util.AbstractFileClassLoader` with `scala.reflect.internal.util.AbstractFileClassLoader` --- src/compiler/scala/reflect/quasiquotes/Holes.scala | 2 +- src/compiler/scala/tools/ant/FastScalac.scala | 2 +- src/compiler/scala/tools/ant/sabbus/Compiler.scala | 2 +- src/compiler/scala/tools/ant/sabbus/ScalacFork.scala | 2 +- src/compiler/scala/tools/nsc/EvalLoop.scala | 3 ++- src/compiler/scala/tools/nsc/GenericRunnerCommand.scala | 3 ++- src/compiler/scala/tools/nsc/ObjectRunner.scala | 2 +- src/compiler/scala/tools/nsc/ast/NodePrinters.scala | 1 + src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 4 ++-- .../scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala | 1 + src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 8 ++++---- src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 1 + src/compiler/scala/tools/nsc/plugins/Plugin.scala | 6 +++--- .../scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 6 +++--- src/compiler/scala/tools/nsc/transform/Constructors.scala | 1 + src/compiler/scala/tools/nsc/transform/Erasure.scala | 2 +- src/compiler/scala/tools/nsc/transform/Mixin.scala | 2 +- src/compiler/scala/tools/nsc/transform/UnCurry.scala | 3 ++- src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Macros.scala | 3 ++- .../scala/tools/nsc/typechecker/MethodSynthesis.scala | 1 + src/compiler/scala/tools/nsc/typechecker/Namers.scala | 3 ++- .../scala/tools/nsc/typechecker/PatternTypers.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 4 ++-- .../scala/tools/nsc/typechecker/SyntheticMethods.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 13 +++++++------ src/compiler/scala/tools/nsc/typechecker/Unapplies.scala | 1 + src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 2 +- src/library/scala/runtime/BoxesRunTime.java | 6 +----- src/reflect/scala/reflect/api/Types.scala | 2 +- src/reflect/scala/reflect/internal/Importers.scala | 2 +- src/reflect/scala/reflect/internal/Symbols.scala | 1 - src/reflect/scala/reflect/internal/TreeGen.scala | 4 ++-- src/reflect/scala/reflect/internal/Trees.scala | 2 +- src/reflect/scala/reflect/internal/Types.scala | 2 +- 35 files changed, 55 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/reflect/quasiquotes/Holes.scala b/src/compiler/scala/reflect/quasiquotes/Holes.scala index 2bbc753a81..6fa6b9b37a 100644 --- a/src/compiler/scala/reflect/quasiquotes/Holes.scala +++ b/src/compiler/scala/reflect/quasiquotes/Holes.scala @@ -187,7 +187,7 @@ trait Holes { self: Quasiquotes => lazy val tree = tptopt.map { tpt => val TypeDef(_, _, _, typedTpt) = - try c.typeCheck(TypeDef(NoMods, TypeName("T"), Nil, tpt)) + try c.typecheck(TypeDef(NoMods, TypeName("T"), Nil, tpt)) catch { case TypecheckException(pos, msg) => c.abort(pos.asInstanceOf[c.Position], msg) } val tpe = typedTpt.tpe val (iterableRank, _) = stripIterable(tpe) diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala index c3eb9eef9c..6f0a30aa9d 100644 --- a/src/compiler/scala/tools/ant/FastScalac.scala +++ b/src/compiler/scala/tools/ant/FastScalac.scala @@ -15,7 +15,7 @@ import org.apache.tools.ant.types.Path import scala.tools.nsc.Settings import scala.tools.nsc.io.File import scala.tools.nsc.settings.FscSettings -import scala.tools.nsc.util.ScalaClassLoader +import scala.reflect.internal.util.ScalaClassLoader /** An Ant task to compile with the fast Scala compiler (`fsc`). * diff --git a/src/compiler/scala/tools/ant/sabbus/Compiler.scala b/src/compiler/scala/tools/ant/sabbus/Compiler.scala index 65cd9f41c2..81cd1f3196 100644 --- a/src/compiler/scala/tools/ant/sabbus/Compiler.scala +++ b/src/compiler/scala/tools/ant/sabbus/Compiler.scala @@ -12,7 +12,7 @@ package scala.tools.ant.sabbus import java.io.File import java.net.URL import java.lang.reflect.InvocationTargetException -import scala.tools.nsc.util.ScalaClassLoader +import scala.reflect.internal.util.ScalaClassLoader class Compiler(classpath: Array[URL], val settings: Settings) { diff --git a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala index 595b45ae51..cde827ba54 100644 --- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala +++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala @@ -16,7 +16,7 @@ import org.apache.tools.ant.taskdefs.Java import org.apache.tools.ant.util.{ GlobPatternMapper, SourceFileScanner } import org.apache.tools.ant.BuildException import scala.tools.nsc.io -import scala.tools.nsc.util.ScalaClassLoader +import scala.reflect.internal.util.ScalaClassLoader /** An Ant task to compile with the new Scala compiler (NSC). * diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala index 15a296c836..73f4b9a119 100644 --- a/src/compiler/scala/tools/nsc/EvalLoop.scala +++ b/src/compiler/scala/tools/nsc/EvalLoop.scala @@ -6,6 +6,7 @@ package scala.tools.nsc import scala.annotation.tailrec +import scala.io.StdIn import java.io.EOFException trait EvalLoop { @@ -14,7 +15,7 @@ trait EvalLoop { def loop(action: (String) => Unit) { @tailrec def inner() { Console.print(prompt) - val line = try Console.readLine() catch { case _: EOFException => null } + val line = try StdIn.readLine() catch { case _: EOFException => null } if (line != null && line != "") { action(line) inner() diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala index dbdeec809f..2584054686 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala @@ -6,6 +6,7 @@ package scala.tools.nsc import GenericRunnerCommand._ +import scala.reflect.internal.util.ScalaClassLoader /** A command for ScriptRunner */ class GenericRunnerCommand( @@ -32,7 +33,7 @@ extends CompilerCommand(args, settings) { private def guessHowToRun(target: String): GenericRunnerCommand.HowToRun = { if (!ok) Error else if (io.Jar.isJarOrZip(target)) AsJar - else if (util.ScalaClassLoader.classExists(settings.classpathURLs, target)) AsObject + else if (ScalaClassLoader.classExists(settings.classpathURLs, target)) AsObject else { val f = io.File(target) if (!f.hasExtension("class", "jar", "zip") && f.canRead) AsScript diff --git a/src/compiler/scala/tools/nsc/ObjectRunner.scala b/src/compiler/scala/tools/nsc/ObjectRunner.scala index 7c14f4943f..8e01418e8b 100644 --- a/src/compiler/scala/tools/nsc/ObjectRunner.scala +++ b/src/compiler/scala/tools/nsc/ObjectRunner.scala @@ -7,8 +7,8 @@ package scala.tools.nsc import java.net.URL -import util.ScalaClassLoader import util.Exceptional.unwrap +import scala.reflect.internal.util.ScalaClassLoader trait CommonRunner { /** Run a given object, specified by name, using a diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala index 9c8e13a1a9..6fe85cde7a 100644 --- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala @@ -9,6 +9,7 @@ package ast import scala.compat.Platform.EOL import symtab.Flags._ import scala.language.postfixOps +import scala.reflect.internal.util.ListOfNil /** The object `nodePrinter` converts the internal tree * representation to a string. diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 4663810003..67e91ae857 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -13,7 +13,7 @@ import scala.collection.{ mutable, immutable } import mutable.{ ListBuffer, StringBuilder } import scala.reflect.internal.{ Precedence, ModifierFlags => Flags } import scala.reflect.internal.Chars.{ isScalaLetter } -import scala.reflect.internal.util.{ SourceFile, Position, FreshNameCreator } +import scala.reflect.internal.util.{ SourceFile, Position, FreshNameCreator, ListOfNil } import Tokens._ /** Historical note: JavaParsers started life as a direct copy of Parsers @@ -2788,7 +2788,7 @@ self => */ def packageObjectDef(start: Offset): PackageDef = { val defn = objectDef(in.offset, NoMods) - val pidPos = o2p(defn.pos.startOrPoint) + val pidPos = o2p(defn.pos.start) val pkgPos = r2p(start, pidPos.point) gen.mkPackageObject(defn, pidPos, pkgPos) } diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala index 8cd915bf22..d2a999cdec 100755 --- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala @@ -8,6 +8,7 @@ package ast.parser import scala.collection.{ mutable, immutable } import symtab.Flags.MUTABLE +import scala.reflect.internal.util.ListOfNil import scala.reflect.internal.util.StringOps.splitWhere /** This class builds instance of `Tree` that represent XML. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 7e79ff3e87..f866c0d038 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -2054,7 +2054,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => seen ::= LocVarEntry(lv, start, end) case _ => // TODO SI-6049 track down the cause for these. - debugwarn(s"$iPos: Visited SCOPE_EXIT before visiting corresponding SCOPE_ENTER. SI-6191") + devWarning(s"$iPos: Visited SCOPE_EXIT before visiting corresponding SCOPE_ENTER. SI-6191") } } @@ -2424,7 +2424,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => // SI-6102: Determine whether eliding this JUMP results in an empty range being covered by some EH. // If so, emit a NOP in place of the elided JUMP, to avoid "java.lang.ClassFormatError: Illegal exception table range" else if (newNormal.isJumpOnly(b) && m.exh.exists(eh => eh.covers(b))) { - debugwarn("Had a jump only block that wasn't collapsed") + devWarning("Had a jump only block that wasn't collapsed") emit(asm.Opcodes.NOP) } @@ -3136,13 +3136,13 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => val (remappings, cycles) = detour partition {case (source, target) => source != target} for ((source, target) <- remappings) { debuglog(s"Will elide jump only block $source because it can be jumped around to get to $target.") - if (m.startBlock == source) debugwarn("startBlock should have been re-wired by now") + if (m.startBlock == source) devWarning("startBlock should have been re-wired by now") } val sources = remappings.keySet val targets = remappings.values.toSet val intersection = sources intersect targets - if (intersection.nonEmpty) debugwarn(s"contradiction: we seem to have some source and target overlap in blocks ${intersection.mkString}. Map was ${detour.mkString}") + if (intersection.nonEmpty) devWarning(s"contradiction: we seem to have some source and target overlap in blocks ${intersection.mkString}. Map was ${detour.mkString}") for ((source, _) <- cycles) { debuglog(s"Block $source is in a do-nothing infinite loop. Did the user write 'while(true){}'?") diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 4ad4c13c0c..d34c14be0f 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -13,6 +13,7 @@ import symtab.Flags import JavaTokens._ import scala.language.implicitConversions import scala.reflect.internal.util.Position +import scala.reflect.internal.util.ListOfNil trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val global : Global diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 7837f9a11a..5a7a0df595 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -7,7 +7,7 @@ package scala.tools.nsc package plugins import scala.tools.nsc.io.{ Jar } -import scala.tools.nsc.util.ScalaClassLoader +import scala.reflect.internal.util.ScalaClassLoader import scala.reflect.io.{ Directory, File, Path } import java.io.InputStream import java.util.zip.ZipException @@ -60,13 +60,13 @@ abstract class Plugin { * @return true to continue, or false to opt out */ def init(options: List[String], error: String => Unit): Boolean = { - processOptions(options, error) + if (!options.isEmpty) error(s"Error: $name takes no options") true } @deprecated("use Plugin#init instead", since="2.11") def processOptions(options: List[String], error: String => Unit): Unit = { - if (!options.isEmpty) error(s"Error: $name takes no options") + init(options, error) } /** A description of this plugin's options, suitable as a response diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 96800175ee..1ffa064b78 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -807,10 +807,10 @@ abstract class ClassfileParser { val c = pool.getConstant(u2) val c1 = convertTo(c, symtype) if (c1 ne null) sym.setInfo(ConstantType(c1)) - else debugwarn(s"failure to convert $c to $symtype") + else devWarning(s"failure to convert $c to $symtype") case tpnme.ScalaSignatureATTR => if (!isScalaAnnot) { - debugwarn(s"symbol ${sym.fullName} has pickled signature in attribute") + devWarning(s"symbol ${sym.fullName} has pickled signature in attribute") unpickler.unpickle(in.buf, in.bp, clazz, staticModule, in.file.name) } in.skip(attrLen) @@ -1123,7 +1123,7 @@ abstract class ClassfileParser { def add(entry: InnerClassEntry): Unit = { inners get entry.externalName foreach (existing => - debugwarn(s"Overwriting inner class entry! Was $existing, now $entry") + devWarning(s"Overwriting inner class entry! Was $existing, now $entry") ) inners(entry.externalName) = entry } diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 362cbde04f..d0fca12e6a 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -8,6 +8,7 @@ package transform import scala.collection.{ mutable, immutable } import scala.collection.mutable.ListBuffer +import scala.reflect.internal.util.ListOfNil import symtab.Flags._ /** This phase converts classes with parameters into Java-like classes with diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 5c72bb3258..facce9062b 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -1036,7 +1036,7 @@ abstract class Erasure extends AddInterfaces // See SI-5568. tree setSymbol Object_getClass } else { - debugwarn(s"The symbol '${fn.symbol}' was interecepted but didn't match any cases, that means the intercepted methods set doesn't match the code") + devWarning(s"The symbol '${fn.symbol}' was interecepted but didn't match any cases, that means the intercepted methods set doesn't match the code") tree } } else qual match { diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index b5ffc8bc58..408f4466e1 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -267,7 +267,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { /* Mix in members of implementation class mixinClass into class clazz */ def mixinImplClassMembers(mixinClass: Symbol, mixinInterface: Symbol) { - if (!mixinClass.isImplClass) debugwarn ("Impl class flag is not set " + + if (!mixinClass.isImplClass) devWarning ("Impl class flag is not set " + ((mixinClass.debugLocationString, mixinInterface.debugLocationString))) for (member <- mixinClass.info.decls ; if isForwarded(member)) { diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index e1cf53059a..3330fbcae2 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -10,6 +10,7 @@ package transform import symtab.Flags._ import scala.collection.{ mutable, immutable } import scala.language.postfixOps +import scala.reflect.internal.util.ListOfNil /* */ /** - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types. @@ -206,7 +207,7 @@ abstract class UnCurry extends InfoTransform // (() => Int) { def apply(): Int @typeConstraint } case RefinedType(List(funTp), decls) => debuglog(s"eliminate refinement from function type ${fun.tpe}") - fun.tpe = funTp + fun.setType(funTp) case _ => () } diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 52132dd74a..5ecca5abce 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -893,7 +893,7 @@ trait Implicits { try improves(firstPending, alt) catch { case e: CyclicReference => - debugwarn(s"Discarding $firstPending during implicit search due to cyclic reference.") + devWarning(s"Discarding $firstPending during implicit search due to cyclic reference.") true } ) diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index da7b8b09aa..10aefae20b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -3,13 +3,14 @@ package typechecker import java.lang.Math.min import symtab.Flags._ -import scala.tools.nsc.util._ +import scala.reflect.internal.util.ScalaClassLoader import scala.reflect.runtime.ReflectionUtils import scala.collection.mutable.ListBuffer import scala.reflect.ClassTag import scala.reflect.internal.util.Statistics import scala.reflect.macros.util._ import scala.util.control.ControlThrowable +import scala.reflect.internal.util.ListOfNil import scala.reflect.macros.runtime.{AbortMacroException, MacroRuntimes} import scala.reflect.runtime.{universe => ru} import scala.reflect.macros.compiler.DefaultMacroCompiler diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 1f00403f3a..f90e32ce8a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -8,6 +8,7 @@ package typechecker import symtab.Flags._ import scala.reflect.internal.util.StringOps.{ ojoin } import scala.reflect.ClassTag +import scala.reflect.internal.util.ListOfNil import scala.reflect.runtime.{ universe => ru } import scala.language.higherKinds diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 4b942e28a6..24238b8e41 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -10,6 +10,7 @@ import scala.collection.mutable import scala.annotation.tailrec import symtab.Flags._ import scala.language.postfixOps +import scala.reflect.internal.util.ListOfNil /** This trait declares methods to create symbols and to enter them into scopes. * @@ -1305,7 +1306,7 @@ trait Namers extends MethodSynthesis { // by martin: the null case can happen in IDE; this is really an ugly hack on top of an ugly hack but it seems to work case Some(cda) => if (cda.companionModuleClassNamer == null) { - debugwarn(s"SI-6576 The companion module namer for $meth was unexpectedly null") + devWarning(s"SI-6576 The companion module namer for $meth was unexpectedly null") return } val p = (cda.classWithDefault, cda.companionModuleClassNamer) diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala index fa4a764f1b..8a66c7d274 100644 --- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala @@ -268,7 +268,7 @@ trait PatternTypers { def freshArgType(tp: Type): Type = tp match { case MethodType(param :: _, _) => param.tpe - case PolyType(tparams, restpe) => createFromClonedSymbols(tparams, freshArgType(restpe))(polyType) + case PolyType(tparams, restpe) => createFromClonedSymbols(tparams, freshArgType(restpe))(genPolyType) case OverloadedType(_, _) => OverloadedUnapplyError(fun) ; ErrorType case _ => UnapplyWithSingleArgError(fun) ; ErrorType } diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index dfc0a433a9..5abfbe850f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1684,9 +1684,9 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans case _ => } if (skipBounds) { - tree.tpe = tree.tpe.map { + tree.setType(tree.tpe.map { _.filterAnnotations(_.symbol != UncheckedBoundsClass) - } + }) } tree diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index d2046a158c..966e8f1abe 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -344,7 +344,7 @@ trait SyntheticMethods extends ast.TreeDSL { // Without a means to suppress this warning, I've thought better of it. if (settings.warnValueOverrides) { (clazz.info nonPrivateMember m.name) filter (m => (m.owner != AnyClass) && (m.owner != clazz) && !m.isDeferred) andAlso { m => - currentUnit.warning(clazz.pos, s"Implementation of ${m.name} inherited from ${m.owner} overridden in $clazz to enforce value class semantics") + typer.context.warning(clazz.pos, s"Implementation of ${m.name} inherited from ${m.owner} overridden in $clazz to enforce value class semantics") } } true diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 46f2177035..aef2e437b7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -14,7 +14,7 @@ package tools.nsc package typechecker import scala.collection.{mutable, immutable} -import scala.reflect.internal.util.{ BatchSourceFile, Statistics, shortClassOfInstance } +import scala.reflect.internal.util.{ BatchSourceFile, Statistics, shortClassOfInstance, ListOfNil } import mutable.ListBuffer import symtab.Flags._ import Mode._ @@ -245,7 +245,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper case TypeRef(_, sym, _) if sym.isAliasType => val tp0 = tp.dealias if (tp eq tp0) { - debugwarn(s"dropExistential did not progress dealiasing $tp, see SI-7126") + devWarning(s"dropExistential did not progress dealiasing $tp, see SI-7126") tp } else { val tp1 = dropExistential(tp0) @@ -2565,7 +2565,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val default = methodSym newValueParameter (newTermName("default"), tree.pos.focus, SYNTHETIC) setInfo functionType(List(A1.tpe), B1.tpe) val paramSyms = List(x, default) - methodSym setInfo polyType(List(A1, B1), MethodType(paramSyms, B1.tpe)) + methodSym setInfo genPolyType(List(A1, B1), MethodType(paramSyms, B1.tpe)) val methodBodyTyper = newTyper(context.makeNewScope(context.tree, methodSym)) if (!paramSynthetic) methodBodyTyper.context.scope enter x @@ -2865,7 +2865,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper ClassDef(Modifiers(FINAL), tpnme.ANON_FUN_NAME, tparams = Nil, gen.mkTemplate( parents = TypeTree(samClassTpFullyDefined) :: serializableParentAddendum, - self = emptyValDef, + self = noSelfType, constrMods = NoMods, vparamss = ListOfNil, body = List(samDef), @@ -2934,7 +2934,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper var issuedMissingParameterTypeError = false foreach2(fun.vparams, argpts) { (vparam, argpt) => if (vparam.tpt.isEmpty) { - vparam.tpt.tpe = + val vparamType = if (isFullyDefined(argpt)) argpt else { fun match { @@ -2953,6 +2953,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper issuedMissingParameterTypeError = true ErrorType } + vparam.tpt.setType(vparamType) if (!vparam.tpt.pos.isDefined) vparam.tpt setPos vparam.pos.focus } } @@ -5381,7 +5382,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper ) def runTyper(): Tree = { if (retypingOk) { - tree.tpe = null + tree.setType(null) if (tree.hasSymbolField) tree.symbol = NoSymbol } val alreadyTyped = tree.tpe ne null diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala index fc1f45e358..22fb0728e6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala @@ -7,6 +7,7 @@ package scala.tools.nsc package typechecker import symtab.Flags._ +import scala.reflect.internal.util.ListOfNil /* * @author Martin Odersky diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index 1643e0061f..47c88f2c00 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -7,7 +7,7 @@ import scala.tools.nsc.Global import scala.tools.nsc.reporters._ import scala.tools.nsc.CompilerCommand import scala.tools.nsc.io.{AbstractFile, VirtualDirectory} -import scala.tools.nsc.util.AbstractFileClassLoader +import scala.reflect.internal.util.AbstractFileClassLoader import scala.reflect.internal.Flags._ import scala.reflect.internal.util.{BatchSourceFile, NoSourceFile, NoFile} import java.lang.{Class => jClass} diff --git a/src/library/scala/runtime/BoxesRunTime.java b/src/library/scala/runtime/BoxesRunTime.java index 82a3b00ac4..9cb1dee41c 100644 --- a/src/library/scala/runtime/BoxesRunTime.java +++ b/src/library/scala/runtime/BoxesRunTime.java @@ -28,7 +28,7 @@ import scala.math.ScalaNumber; * @version 2.0 */ public final class BoxesRunTime { - private static final int CHAR = 0, BYTE = 1, SHORT = 2, INT = 3, LONG = 4, FLOAT = 5, DOUBLE = 6, OTHER = 7; + private static final int CHAR = 0, /* BYTE = 1, SHORT = 2, */ INT = 3, LONG = 4, FLOAT = 5, DOUBLE = 6, OTHER = 7; /** We don't need to return BYTE and SHORT, as everything which might * care widens to INT. @@ -43,10 +43,6 @@ public final class BoxesRunTime return OTHER; } - private static String boxDescription(Object a) { - return "" + a.getClass().getSimpleName() + "(" + a + ")"; - } - /* BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING ... BOXING */ public static java.lang.Boolean boxToBoolean(boolean b) { diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala index f6995dd5de..cd7648a44a 100644 --- a/src/reflect/scala/reflect/api/Types.scala +++ b/src/reflect/scala/reflect/api/Types.scala @@ -469,7 +469,7 @@ trait Types { def unapply(tpe: SingleType): Option[(Type, Symbol)] /** @see [[InternalApi.singleType]] */ - @deprecated("Use `ClassSymbol.thisPrefix` or `internal.singleType` instead") + @deprecated("Use `ClassSymbol.thisPrefix` or `internal.singleType` instead", "2.11.0") def apply(pre: Type, sym: Symbol)(implicit token: CompatToken): Type = internal.singleType(pre, sym) } diff --git a/src/reflect/scala/reflect/internal/Importers.scala b/src/reflect/scala/reflect/internal/Importers.scala index dc4ad25ef2..494f62af06 100644 --- a/src/reflect/scala/reflect/internal/Importers.scala +++ b/src/reflect/scala/reflect/internal/Importers.scala @@ -301,7 +301,7 @@ trait Importers { to: SymbolTable => case (their: from.TypeTree, my: to.TypeTree) => if (their.wasEmpty) my.defineType(importType(their.tpe)) else my.setType(importType(their.tpe)) case (_, _) => - my.tpe = importType(their.tpe) + my.setType(importType(their.tpe)) } } } diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index f4b741bd19..d85ec22a84 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2821,7 +2821,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => // SI-6888 Approximate the name to workaround the deficiencies in `nme.originalName` // in the face of classes named '$'. SI-2806 remains open to address the deeper problem. if (unexpandedName endsWith (nme.OUTER)) initialize.referenced - else NoSymbol def setModuleClass(clazz: Symbol): TermSymbol = { diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala index b3e11a826e..75a1969d22 100644 --- a/src/reflect/scala/reflect/internal/TreeGen.scala +++ b/src/reflect/scala/reflect/internal/TreeGen.scala @@ -362,7 +362,7 @@ abstract class TreeGen { if (body forall treeInfo.isInterfaceMember) None else Some( atPos(wrappingPos(superPos, lvdefs)) ( - DefDef(NoMods, nme.MIXIN_CONSTRUCTOR, Nil, ListOfNil, TypeTree(), Block(lvdefs, Literal(Constant()))))) + DefDef(NoMods, nme.MIXIN_CONSTRUCTOR, Nil, ListOfNil, TypeTree(), Block(lvdefs, Literal(Constant(())))))) } else { // convert (implicit ... ) to ()(implicit ... ) if its the only parameter section @@ -376,7 +376,7 @@ abstract class TreeGen { // therefore here we emit a dummy which gets populated when the template is named and typechecked Some( atPos(wrappingPos(superPos, lvdefs ::: vparamss1.flatten).makeTransparent) ( - DefDef(constrMods, nme.CONSTRUCTOR, List(), vparamss1, TypeTree(), Block(lvdefs ::: List(superCall), Literal(Constant()))))) + DefDef(constrMods, nme.CONSTRUCTOR, List(), vparamss1, TypeTree(), Block(lvdefs ::: List(superCall), Literal(Constant(())))))) } } constr foreach (ensureNonOverlapping(_, parents ::: gvdefs, focus = false)) diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index fd918b8595..e3f95f9fd8 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -87,7 +87,7 @@ trait Trees extends api.Trees { private[scala] def copyAttrs(tree: Tree): this.type = { rawatt = tree.rawatt - tpe = tree.tpe + setType(tree.tpe) if (hasSymbolField) symbol = tree.symbol this } diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index ad2a545587..86a53a1b02 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -209,7 +209,7 @@ trait Types case object UnmappableTree extends TermTree { override def toString = "" - super.tpe_=(NoType) + super.setType(NoType) override def tpe_=(t: Type) = if (t != NoType) { throw new UnsupportedOperationException("tpe_=("+t+") inapplicable for ") } -- cgit v1.2.3