Permalink
Browse files

miscellaneous cleanup, mostly fighting with feature warnings

  • Loading branch information...
xeno-by committed Jun 6, 2012
1 parent 6355d1a commit 3896a416faffe337a96f873214b02f231f306174
Showing with 144 additions and 110 deletions.
  1. +3 −3 src/compiler/scala/reflect/internal/BaseTypeSeqs.scala
  2. +3 −1 src/compiler/scala/reflect/internal/Chars.scala
  3. +1 −1 src/compiler/scala/reflect/internal/Definitions.scala
  4. +3 −3 src/compiler/scala/reflect/internal/Importers.scala
  5. +0 −2 src/compiler/scala/reflect/internal/StdAttachments.scala
  6. +5 −5 src/compiler/scala/reflect/internal/StdNames.scala
  7. +3 −3 src/compiler/scala/reflect/internal/Symbols.scala
  8. +1 −1 src/compiler/scala/reflect/internal/TypeDebugging.scala
  9. +1 −0 src/compiler/scala/reflect/internal/Types.scala
  10. +1 −1 src/compiler/scala/reflect/internal/pickling/UnPickler.scala
  11. +2 −0 src/compiler/scala/reflect/internal/transform/Transforms.scala
  12. +1 −0 src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala
  13. +1 −1 src/compiler/scala/reflect/makro/runtime/Context.scala
  14. +2 −1 src/compiler/scala/reflect/makro/runtime/{Util.scala → ExprUtils.scala}
  15. +3 −6 src/compiler/scala/reflect/makro/runtime/Names.scala
  16. +1 −2 src/compiler/scala/reflect/reify/Errors.scala
  17. +1 −2 src/compiler/scala/reflect/reify/Phases.scala
  18. +1 −2 src/compiler/scala/reflect/reify/Reifier.scala
  19. +3 −3 src/compiler/scala/reflect/reify/phases/Reshape.scala
  20. +1 −1 src/compiler/scala/tools/ant/FastScalac.scala
  21. +1 −1 src/compiler/scala/tools/ant/Scalac.scala
  22. +1 −0 src/compiler/scala/tools/cmd/CommandLine.scala
  23. +2 −0 src/compiler/scala/tools/cmd/gen/Codegen.scala
  24. +1 −1 src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
  25. +2 −2 src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
  26. +1 −0 src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
  27. +0 −1 src/compiler/scala/tools/nsc/transform/Erasure.scala
  28. +1 −0 src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
  29. +2 −0 src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala
  30. +2 −1 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
  31. +28 −26 src/compiler/scala/tools/nsc/typechecker/Macros.scala
  32. +3 −2 src/compiler/scala/tools/nsc/typechecker/Typers.scala
  33. +2 −2 src/compiler/scala/tools/reflect/WrappedProperties.scala
  34. +1 −0 src/compiler/scala/tools/util/Javap.scala
  35. +1 −0 src/compiler/scala/tools/util/PathResolver.scala
  36. +2 −0 src/library/scala/collection/generic/package.scala
  37. +7 −7 src/library/scala/languageFeature.scala
  38. +2 −2 src/library/scala/reflect/NameTransformer.scala
  39. +3 −1 src/library/scala/reflect/ScalaLongSignature.java
  40. +2 −1 src/library/scala/reflect/ScalaSignature.java
  41. +1 −1 src/library/scala/reflect/api/Exprs.scala
  42. +2 −1 src/library/scala/reflect/makro/Aliases.scala
  43. +2 −1 src/library/scala/reflect/makro/CapturedVariables.scala
  44. +3 −2 src/library/scala/reflect/makro/Context.scala
  45. +2 −1 src/library/scala/reflect/makro/Enclosures.scala
  46. +2 −1 src/library/scala/reflect/makro/Evals.scala
  47. +3 −2 src/library/scala/reflect/makro/{Util.scala → ExprUtils.scala}
  48. +2 −1 src/library/scala/reflect/makro/Exprs.scala
  49. +2 −1 src/library/scala/reflect/makro/FrontEnds.scala
  50. +2 −1 src/library/scala/reflect/makro/Infrastructure.scala
  51. +2 −1 src/library/scala/reflect/makro/Names.scala
  52. +2 −1 src/library/scala/reflect/makro/Parsers.scala
  53. +3 −2 src/library/scala/reflect/makro/Reifiers.scala
  54. +3 −1 src/library/scala/reflect/makro/Settings.scala
  55. +2 −1 src/library/scala/reflect/makro/TreeBuilder.scala
  56. +2 −1 src/library/scala/reflect/makro/TypeTags.scala
  57. +2 −1 src/library/scala/reflect/makro/Typers.scala
  58. +4 −3 src/library/scala/reflect/makro/Universe.scala
  59. +2 −2 src/library/scala/reflect/makro/internal/package.scala
@@ -225,9 +225,9 @@ trait BaseTypeSeqs {
nextRawElem(i) match {
case RefinedType(variants, decls) =>
for (tp <- variants)
- if (!(minTypes exists (tp =:=))) minTypes = tp :: minTypes
+ if (!(minTypes exists (tp =:= _))) minTypes = tp :: minTypes
case tp =>
- if (!(minTypes exists (tp =:=))) minTypes = tp :: minTypes
+ if (!(minTypes exists (tp =:= _))) minTypes = tp :: minTypes
}
index(i) = index(i) + 1
}
@@ -252,7 +252,7 @@ trait BaseTypeSeqs {
override def map(g: Type => Type) = lateMap(g)
override def lateMap(g: Type => Type) = orig.lateMap(x => g(f(x)))
override def exists(p: Type => Boolean) = elems exists (x => p(f(x)))
- override protected def maxDepthOfElems: Int = elems map (x => maxDpth(f(x))) max
+ override protected def maxDepthOfElems: Int = (elems map (x => maxDpth(f(x)))).max
override def toString = elems.mkString("MBTS(", ",", ")")
}
@@ -2,10 +2,12 @@
* Copyright 2006-2011 LAMP/EPFL
* @author Martin Odersky
*/
-package scala.reflect.internal
+package scala.reflect
+package internal
import annotation.{ tailrec, switch }
import java.lang.{ Character => JCharacter }
+import language.postfixOps
/** Contains constants and classifier methods for characters */
trait Chars {
@@ -770,7 +770,7 @@ trait Definitions extends api.StandardDefinitions {
existentialAbstraction(
eparams,
- ClassType(eparams.head setInfo TypeBounds.upper(upperBound) tpe)
+ ClassType((eparams.head setInfo TypeBounds.upper(upperBound)).tpe)
)
}
}
@@ -417,17 +417,17 @@ trait Importers { self: SymbolTable =>
}
addFixup({
if (mytree != null) {
- val mysym = if (tree hasSymbol) importSymbol(tree.symbol) else NoSymbol
+ val mysym = if (tree.hasSymbol) importSymbol(tree.symbol) else NoSymbol
val mytpe = importType(tree.tpe)
mytree match {
case mytt: TypeTree =>
val tt = tree.asInstanceOf[from.TypeTree]
- if (mytree hasSymbol) mytt.symbol = mysym
+ if (mytree.hasSymbol) mytt.symbol = mysym
if (tt.wasEmpty) mytt.defineType(mytpe) else mytt.setType(mytpe)
if (tt.original != null) mytt.setOriginal(importTree(tt.original))
case _ =>
- if (mytree hasSymbol) mytree.symbol = importSymbol(tree.symbol)
+ if (mytree.hasSymbol) mytree.symbol = importSymbol(tree.symbol)
mytree.tpe = importType(tree.tpe)
}
}
@@ -1,8 +1,6 @@
package scala.reflect
package internal
-import scala.reflect.makro.runtime.{Context => MacroContext}
-
trait StdAttachments {
self: SymbolTable =>
@@ -72,7 +72,7 @@ trait StdNames {
val cs = s.toArray
val bytes = Codec toUTF8 cs
md5 update bytes
- val md5chars = md5.digest() map (b => (b & 0xFF).toHexString) mkString
+ val md5chars = (md5.digest() map (b => (b & 0xFF).toHexString)).mkString
prefix + marker + md5chars + marker + suffix
}
@@ -262,10 +262,10 @@ trait StdNames {
final val SourceFileATTR: NameType = "SourceFile"
final val SyntheticATTR: NameType = "Synthetic"
- def dropSingletonName(name: Name): TypeName = name dropRight SINGLETON_SUFFIX.length toTypeName
- def singletonName(name: Name): TypeName = name append SINGLETON_SUFFIX toTypeName
- def implClassName(name: Name): TypeName = name append IMPL_CLASS_SUFFIX toTypeName
- def interfaceName(implname: Name): TypeName = implname dropRight IMPL_CLASS_SUFFIX.length toTypeName
+ def dropSingletonName(name: Name): TypeName = (name dropRight SINGLETON_SUFFIX.length).toTypeName
+ def singletonName(name: Name): TypeName = (name append SINGLETON_SUFFIX).toTypeName
+ def implClassName(name: Name): TypeName = (name append IMPL_CLASS_SUFFIX).toTypeName
+ def interfaceName(implname: Name): TypeName = (implname dropRight IMPL_CLASS_SUFFIX.length).toTypeName
}
abstract class TermNames extends Keywords with TermNamesApi {
@@ -1667,7 +1667,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
* The empty list for all other classes.
*/
final def caseFieldAccessors: List[Symbol] =
- info.decls filter (_.isCaseAccessorMethod) toList
+ (info.decls filter (_.isCaseAccessorMethod)).toList
final def constrParamAccessors: List[Symbol] =
info.decls.toList filter (sym => !sym.isMethod && sym.isParamAccessor)
@@ -1730,7 +1730,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
*/
def mixinClasses: List[Symbol] = {
val sc = superClass
- ancestors takeWhile (sc ne)
+ ancestors takeWhile (sc ne _)
}
/** All directly or indirectly inherited classes. */
@@ -1994,7 +1994,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
* pre: `this.owner` is in the base class sequence of `base`.
*/
final def superSymbol(base: Symbol): Symbol = {
- var bcs = base.info.baseClasses.dropWhile(owner !=).tail
+ var bcs = base.info.baseClasses.dropWhile(owner != _).tail
var sym: Symbol = NoSymbol
while (!bcs.isEmpty && sym == NoSymbol) {
if (!bcs.head.isImplClass)
@@ -24,7 +24,7 @@ trait TypeDebugging {
def ptBlock(label: String, pairs: (String, Any)*): String = {
if (pairs.isEmpty) label + "{ }"
else {
- val width = pairs map (_._1.length) max
+ val width = (pairs map (_._1.length)).max
val fmt = "%-" + (width + 1) + "s %s"
val strs = pairs map { case (k, v) => fmt.format(k, to_s(v)) }
@@ -14,6 +14,7 @@ import Flags._
import scala.util.control.ControlThrowable
import scala.annotation.tailrec
import util.Statistics._
+import language.postfixOps
/* A standard type pattern match:
case ErrorType =>
@@ -358,7 +358,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ {
case POLYtpe =>
val restpe = readTypeRef()
val typeParams = until(end, readSymbolRef)
- if(typeParams nonEmpty) {
+ if (typeParams.nonEmpty) {
// NMT_TRANSITION: old class files denoted a polymorphic nullary method as PolyType(tps, restpe), we now require PolyType(tps, NullaryMethodType(restpe))
// when a type of kind * is expected (forceProperType is true), we know restpe should be wrapped in a NullaryMethodType (if it wasn't suitably wrapped yet)
def transitionNMT(restpe: Type) = {
@@ -2,6 +2,8 @@ package scala.reflect
package internal
package transform
+import language.existentials
+
trait Transforms { self: SymbolTable =>
/** We need to encode laziness by hand here because the three components refChecks, uncurry and erasure
@@ -2,6 +2,7 @@ package scala.reflect.internal
package util
import scala.collection.{ mutable, immutable }
+import language.postfixOps
trait TraceSymbolActivity {
val global: SymbolTable
@@ -18,7 +18,7 @@ abstract class Context extends scala.reflect.makro.Context
with Exprs
with TypeTags
with Evals
- with Util
+ with ExprUtils
with Traces {
val universe: Global
@@ -1,10 +1,11 @@
package scala.reflect.makro
package runtime
-trait Util {
+trait ExprUtils {
self: Context =>
import universe._
+ import mirror._
def literalNull = Expr[Null](Literal(Constant(null)))(TypeTag.Null)
@@ -6,15 +6,12 @@ trait Names {
lazy val freshNameCreator = callsiteTyper.context.unit.fresh
- def fresh(): String = {
+ def fresh(): String =
freshNameCreator.newName()
- }
- def fresh(name: String): String = {
+ def fresh(name: String): String =
freshNameCreator.newName(name)
- }
- def fresh[NameType <: Name](name: NameType): NameType = {
+ def fresh[NameType <: Name](name: NameType): NameType =
name.mapName(freshNameCreator.newName(_)).asInstanceOf[NameType]
- }
}
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import scala.reflect.makro.ReificationError
import scala.reflect.makro.UnexpectedReificationError
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import phases._
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import scala.tools.nsc.Global
import scala.reflect.makro.ReificationError
@@ -252,7 +252,7 @@ trait Reshape {
// [Eugene] is this implemented correctly?
private def trimAccessors(deff: Tree, stats: List[Tree]): List[Tree] = {
- val symdefs = stats collect { case vodef: ValOrDefDef => vodef } map (vodeff => vodeff.symbol -> vodeff) toMap
+ val symdefs = (stats collect { case vodef: ValOrDefDef => vodef } map (vodeff => vodeff.symbol -> vodeff)).toMap
val accessors = collection.mutable.Map[ValDef, List[DefDef]]()
stats collect { case ddef: DefDef => ddef } foreach (defdef => {
val valdef = symdefs get defdef.symbol.accessedOrSelf collect { case vdef: ValDef => vdef } getOrElse null
@@ -262,8 +262,8 @@ trait Reshape {
if (defdef.name.startsWith(prefix)) {
var name = defdef.name.toString.substring(prefix.length)
def uncapitalize(s: String) = if (s.length == 0) "" else { val chars = s.toCharArray; chars(0) = chars(0).toLower; new String(chars) }
- def findValDef(name: String) = symdefs.values collect { case vdef: ValDef if nme.dropLocalSuffix(vdef.name).toString == name => vdef } headOption;
- val valdef = findValDef(name) orElse findValDef(uncapitalize(name)) orNull;
+ def findValDef(name: String) = (symdefs.values collect { case vdef: ValDef if nme.dropLocalSuffix(vdef.name).toString == name => vdef }).headOption
+ val valdef = findValDef(name).orElse(findValDef(uncapitalize(name))).orNull
if (valdef != null) accessors(valdef) = accessors.getOrElse(valdef, Nil) :+ defdef
}
}
@@ -157,7 +157,7 @@ class FastScalac extends Scalac {
val scalaHome: String = try {
val url = ScalaClassLoader.originOfClass(classOf[FastScalac]).get
- File(url.getFile).jfile.getParentFile.getParentFile getAbsolutePath
+ File(url.getFile).jfile.getParentFile.getParentFile.getAbsolutePath
} catch {
case _ =>
buildError("Compilation failed because of an internal compiler error;"+
@@ -632,7 +632,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared {
case "none" =>
case x =>
val depFilePath = SPath(x)
- command.settings.dependenciesFile.value = SPath(getProject.getBaseDir).normalize resolve depFilePath path
+ command.settings.dependenciesFile.value = SPath(getProject.getBaseDir).normalize.resolve(depFilePath).path
}
(command.settings, sourceFiles, javaOnly)
@@ -7,6 +7,7 @@ package scala.tools
package cmd
import scala.collection.mutable.ListBuffer
+import language.postfixOps
trait CommandLineConfig {
def enforceArity: Boolean = true
@@ -6,6 +6,8 @@
package scala.tools.cmd
package gen
+import language.postfixOps
+
class Codegen(args: List[String]) extends {
val parsed = CodegenSpec(args: _*)
} with CodegenSpec with Instance { }
@@ -185,7 +185,7 @@ trait Scanners extends ScannersCommon {
sepRegions.nonEmpty && sepRegions.head == STRINGLIT
/** Are we directly in a multiline string interpolation expression?
- * @pre: inStringInterpolation
+ * @pre inStringInterpolation
*/
@inline private def inMultiLineInterpolation =
inStringInterpolation && sepRegions.tail.nonEmpty && sepRegions.tail.head == STRINGPART
@@ -1711,7 +1711,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
abort("Unknown arithmetic primitive " + primitive)
}
- case Logical(op, kind) => (op, kind) match {
+ case Logical(op, kind) => ((op, kind): @unchecked) match {
case (AND, LONG) => jcode.emitLAND()
case (AND, INT) => jcode.emitIAND()
case (AND, _) =>
@@ -1734,7 +1734,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
jcode.emitT2T(javaType(INT), javaType(kind));
}
- case Shift(op, kind) => (op, kind) match {
+ case Shift(op, kind) => ((op, kind): @unchecked) match {
case (LSL, LONG) => jcode.emitLSHL()
case (LSL, INT) => jcode.emitISHL()
case (LSL, _) =>
@@ -14,6 +14,7 @@ import scala.reflect.runtime.{universe => ru}
import scala.reflect.{ClassTag, classTag}
import typechecker.DestructureTypes
import scala.tools.util.StringOps.ojoin
+import language.implicitConversions
/** A more principled system for turning types into strings.
*/
@@ -638,7 +638,6 @@ abstract class Erasure extends AddInterfaces
*/
private def adaptMember(tree: Tree): Tree = {
//Console.println("adaptMember: " + tree);
- val x = 2 + 2
tree match {
case Apply(TypeApply(sel @ Select(qual, name), List(targ)), List())
if tree.symbol == Any_asInstanceOf =>
@@ -9,6 +9,7 @@ package transform
import scala.tools.nsc.symtab.Flags
import scala.collection.{ mutable, immutable }
import language.postfixOps
+import language.existentials
/** Specialize code on types.
*
@@ -6,6 +6,8 @@
package scala.tools.nsc
package typechecker
+import language.implicitConversions
+
/** A generic means of breaking down types into their subcomponents.
* Types are decomposed top down, and recognizable substructure is
* dispatched via self-apparently named methods. Those methods can
@@ -17,6 +17,7 @@ import mutable.{ LinkedHashMap, ListBuffer }
import scala.util.matching.Regex
import symtab.Flags._
import util.Statistics._
+import language.implicitConversions
/** This trait provides methods to find various kinds of implicits.
*
@@ -335,7 +336,7 @@ trait Implicits {
* The _complexity_ of a stripped core type corresponds roughly to the number of
* nodes in its ast, except that singleton types are widened before taking the complexity.
* Two types overlap if they have the same type symbol, or
- * if one or both are intersection types with a pair of overlapiing parent types.
+ * if one or both are intersection types with a pair of overlapping parent types.
*/
private def dominates(dtor: Type, dted: Type): Boolean = {
def core(tp: Type): Type = tp.normalize match {
Oops, something went wrong.

0 comments on commit 3896a41

Please sign in to comment.