diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-05 23:10:16 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-07 11:45:49 -0800 |
commit | 21773d31c1e15d2eec3cf2c8623d582be0a8e4ca (patch) | |
tree | 1e6c8f2239df1af2fb62b6ae0890dcffd6d24873 /src/compiler/scala/tools/nsc | |
parent | 33f3c60ce1931b450053ba4635f7227727aed668 (diff) | |
download | scala-21773d31c1e15d2eec3cf2c8623d582be0a8e4ca.tar.gz scala-21773d31c1e15d2eec3cf2c8623d582be0a8e4ca.tar.bz2 scala-21773d31c1e15d2eec3cf2c8623d582be0a8e4ca.zip |
More warnings eliminations.
Deprecation warnings, unchecked warnings, "that's not the value you
think it is" warnings. Also eliminated a warning by fixing a warning bug.
Diffstat (limited to 'src/compiler/scala/tools/nsc')
8 files changed, 19 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 7fea76c7b1..f900859f46 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -22,8 +22,8 @@ import symtab.Flags.{ACCESSOR, PARAMACCESSOR} /** The main class of the presentation compiler in an interactive environment such as an IDE */ -class Global(settings: Settings, reporter: Reporter, projectName: String = "") - extends scala.tools.nsc.Global(settings, reporter) +class Global(settings: Settings, _reporter: Reporter, projectName: String = "") + extends scala.tools.nsc.Global(settings, _reporter) with CompilerControl with RangePositions with ContextTrees diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index d001a0af8b..98345dd01e 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -297,7 +297,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case nme.toDouble => "toDouble" case _ => return None } - Some(newName, runtimeTest) + Some((newName, runtimeTest)) } def infixTest(name: Name): Option[(String, Tree => Tree)] = { val (newName, runtimeTest) = name match { @@ -322,7 +322,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case nme.ZAND => ("takeConditionalAnd", testForBoolean) case _ => return None } - Some(newName, runtimeTest) + Some((newName, runtimeTest)) } /** The Tree => Tree function in the return is necessary to prevent the original qual diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 9806857ff2..1a421eb82f 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -421,7 +421,7 @@ abstract class Erasure extends AddInterfaces */ /** The modifier typer which retypes with erased types. */ - class Eraser(context: Context) extends Typer(context) { + class Eraser(_context: Context) extends Typer(_context) { private def safeToRemoveUnbox(cls: Symbol): Boolean = (cls == definitions.NullClass) || isBoxedValueClass(cls) diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index 031be21f24..2bed5bffd4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -69,7 +69,7 @@ abstract class Duplicators extends Analyzer { * tree, except for TypeTrees, are erased prior to type checking. TypeTrees * are fixed by substituting invalid symbols for the new ones. */ - class BodyDuplicator(context: Context) extends Typer(context: Context) { + class BodyDuplicator(_context: Context) extends Typer(_context) { class FixInvalidSyms extends TypeMap { diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 79db9ab000..5b38ddd092 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1311,7 +1311,11 @@ trait Infer { case TypeRef(_, sym, _) if isLocalBinding(sym) => ; case _ => - patternWarning(arg, "non variable type-argument ") + // Want to warn about type arguments, not type parameters. Otherwise we'll + // see warnings about "invisible" types, like: val List(x0) = x1 leading to "non + // variable type-argument A in type pattern List[A]..." + if (!arg.typeSymbol.isTypeParameterOrSkolem) + patternWarning(arg, "non variable type-argument ") } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 0f57285480..364e887939 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -422,7 +422,7 @@ trait Namers extends MethodSynthesis { * @return the companion object symbol. */ def ensureCompanionObject(cdef: ClassDef, creator: ClassDef => Tree = companionModuleDef(_)): Symbol = { - val m = companionModuleOf(cdef.symbol, context) + val m = companionSymbolOf(cdef.symbol, context) // @luc: not sure why "currentRun.compiles(m)" is needed, things breaks // otherwise. documentation welcome. // @@ -855,7 +855,7 @@ trait Namers extends MethodSynthesis { // @check: this seems to work only if the type completer of the class runs before the one of the // module class: the one from the module class removes the entry from classOfModuleClass (see above). if (clazz.isClass && !clazz.hasModuleFlag) { - val modClass = companionModuleOf(clazz, context).moduleClass + val modClass = companionSymbolOf(clazz, context).moduleClass Namers.this.classOfModuleClass get modClass map { cdefRef => val cdef = cdefRef() @@ -1082,7 +1082,7 @@ trait Namers extends MethodSynthesis { val parentNamer = if (isConstr) { val (cdef, nmr) = moduleNamer.getOrElse { - val module = companionModuleOf(clazz, context) + val module = companionSymbolOf(clazz, context) module.initialize // call type completer (typedTemplate), adds the // module's templateNamer to classAndNamerOfModule classAndNamerOfModule get module match { diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index e4ebe13217..8611fafe52 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -189,7 +189,7 @@ trait NamesDefaults { self: Analyzer => if (pre == NoType) { None } else { - val module = companionModuleOf(baseFun.symbol.owner, context) + val module = companionSymbolOf(baseFun.symbol.owner, context) if (module == NoSymbol) None else { val ref = atPos(pos.focus)(gen.mkAttributedRef(pre, module)) @@ -414,7 +414,7 @@ trait NamesDefaults { self: Analyzer => if (i > 0) { val defGetterName = nme.defaultGetterName(param.owner.name, i) if (param.owner.isConstructor) { - val mod = companionModuleOf(param.owner.owner, context) + val mod = companionSymbolOf(param.owner.owner, context) mod.info.member(defGetterName) } else { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7671ccbed7..9b03d59216 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1361,7 +1361,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { "you want, you must write the annotation class in Java.") if (!isPastTyper) { for (ann <- clazz.getAnnotation(DeprecatedAttr)) { - val m = companionModuleOf(clazz, context) + val m = companionSymbolOf(clazz, context) if (m != NoSymbol) m.moduleClass.addAnnotation(AnnotationInfo(ann.atp, ann.args, List())) } @@ -1377,7 +1377,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { def typedModuleDef(mdef: ModuleDef): Tree = { // initialize all constructors of the linked class: the type completer (Namer.methodSig) // might add default getters to this object. example: "object T; class T(x: Int = 1)" - val linkedClass = companionClassOf(mdef.symbol, context) + val linkedClass = companionSymbolOf(mdef.symbol, context) if (linkedClass != NoSymbol) linkedClass.info.decl(nme.CONSTRUCTOR).alternatives foreach (_.initialize) @@ -2223,7 +2223,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { (methCtx != NoContext) && { val contextFun = methCtx.tree.symbol contextFun.isPrimaryConstructor && contextFun.owner.isModuleClass && - companionModuleOf(calledFun.owner, context).moduleClass == contextFun.owner + companionSymbolOf(calledFun.owner, context).moduleClass == contextFun.owner } } } |