summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/internal/BaseTypeSeqs.scala6
-rw-r--r--src/compiler/scala/reflect/internal/Chars.scala4
-rw-r--r--src/compiler/scala/reflect/internal/Definitions.scala2
-rw-r--r--src/compiler/scala/reflect/internal/Importers.scala6
-rw-r--r--src/compiler/scala/reflect/internal/StdAttachments.scala2
-rw-r--r--src/compiler/scala/reflect/internal/StdNames.scala10
-rw-r--r--src/compiler/scala/reflect/internal/Symbols.scala6
-rw-r--r--src/compiler/scala/reflect/internal/TypeDebugging.scala2
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala1
-rw-r--r--src/compiler/scala/reflect/internal/pickling/UnPickler.scala2
-rw-r--r--src/compiler/scala/reflect/internal/transform/Transforms.scala2
-rw-r--r--src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala1
-rw-r--r--src/compiler/scala/reflect/makro/runtime/Context.scala2
-rw-r--r--src/compiler/scala/reflect/makro/runtime/ExprUtils.scala (renamed from src/compiler/scala/reflect/makro/runtime/Util.scala)3
-rw-r--r--src/compiler/scala/reflect/makro/runtime/Names.scala9
-rw-r--r--src/compiler/scala/reflect/reify/Errors.scala3
-rw-r--r--src/compiler/scala/reflect/reify/Phases.scala3
-rw-r--r--src/compiler/scala/reflect/reify/Reifier.scala3
-rw-r--r--src/compiler/scala/reflect/reify/phases/Reshape.scala6
-rw-r--r--src/compiler/scala/tools/ant/FastScalac.scala2
-rw-r--r--src/compiler/scala/tools/ant/Scalac.scala2
-rw-r--r--src/compiler/scala/tools/cmd/CommandLine.scala1
-rw-r--r--src/compiler/scala/tools/cmd/gen/Codegen.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala54
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
-rw-r--r--src/compiler/scala/tools/reflect/WrappedProperties.scala4
-rw-r--r--src/compiler/scala/tools/util/Javap.scala1
-rw-r--r--src/compiler/scala/tools/util/PathResolver.scala1
35 files changed, 85 insertions, 74 deletions
diff --git a/src/compiler/scala/reflect/internal/BaseTypeSeqs.scala b/src/compiler/scala/reflect/internal/BaseTypeSeqs.scala
index 3753a45133..e07f1bac49 100644
--- a/src/compiler/scala/reflect/internal/BaseTypeSeqs.scala
+++ b/src/compiler/scala/reflect/internal/BaseTypeSeqs.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(", ",", ")")
}
diff --git a/src/compiler/scala/reflect/internal/Chars.scala b/src/compiler/scala/reflect/internal/Chars.scala
index f2c90a6721..50ec71094a 100644
--- a/src/compiler/scala/reflect/internal/Chars.scala
+++ b/src/compiler/scala/reflect/internal/Chars.scala
@@ -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 {
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala
index 3b32d475ce..d55b38224d 100644
--- a/src/compiler/scala/reflect/internal/Definitions.scala
+++ b/src/compiler/scala/reflect/internal/Definitions.scala
@@ -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)
)
}
}
diff --git a/src/compiler/scala/reflect/internal/Importers.scala b/src/compiler/scala/reflect/internal/Importers.scala
index 72b6288d87..431d9819a5 100644
--- a/src/compiler/scala/reflect/internal/Importers.scala
+++ b/src/compiler/scala/reflect/internal/Importers.scala
@@ -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)
}
}
diff --git a/src/compiler/scala/reflect/internal/StdAttachments.scala b/src/compiler/scala/reflect/internal/StdAttachments.scala
index df1a1267de..4ea9b27da9 100644
--- a/src/compiler/scala/reflect/internal/StdAttachments.scala
+++ b/src/compiler/scala/reflect/internal/StdAttachments.scala
@@ -1,8 +1,6 @@
package scala.reflect
package internal
-import scala.reflect.makro.runtime.{Context => MacroContext}
-
trait StdAttachments {
self: SymbolTable =>
diff --git a/src/compiler/scala/reflect/internal/StdNames.scala b/src/compiler/scala/reflect/internal/StdNames.scala
index 0e5f3efb49..6f68b8f63a 100644
--- a/src/compiler/scala/reflect/internal/StdNames.scala
+++ b/src/compiler/scala/reflect/internal/StdNames.scala
@@ -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 {
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala
index 7305cdaf16..86693cf880 100644
--- a/src/compiler/scala/reflect/internal/Symbols.scala
+++ b/src/compiler/scala/reflect/internal/Symbols.scala
@@ -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)
diff --git a/src/compiler/scala/reflect/internal/TypeDebugging.scala b/src/compiler/scala/reflect/internal/TypeDebugging.scala
index 85a1767067..33f6a645e8 100644
--- a/src/compiler/scala/reflect/internal/TypeDebugging.scala
+++ b/src/compiler/scala/reflect/internal/TypeDebugging.scala
@@ -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)) }
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index ce7a697439..ada998bf9e 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -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 =>
diff --git a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
index bfccdd3988..757163a074 100644
--- a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala
@@ -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) = {
diff --git a/src/compiler/scala/reflect/internal/transform/Transforms.scala b/src/compiler/scala/reflect/internal/transform/Transforms.scala
index a7cc99ba3b..c4c5dc3a1c 100644
--- a/src/compiler/scala/reflect/internal/transform/Transforms.scala
+++ b/src/compiler/scala/reflect/internal/transform/Transforms.scala
@@ -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
diff --git a/src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala b/src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala
index d8c53c0162..5fbeb5f576 100644
--- a/src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala
+++ b/src/compiler/scala/reflect/internal/util/TraceSymbolActivity.scala
@@ -2,6 +2,7 @@ package scala.reflect.internal
package util
import scala.collection.{ mutable, immutable }
+import language.postfixOps
trait TraceSymbolActivity {
val global: SymbolTable
diff --git a/src/compiler/scala/reflect/makro/runtime/Context.scala b/src/compiler/scala/reflect/makro/runtime/Context.scala
index 7fd7a358b8..c7563e7b67 100644
--- a/src/compiler/scala/reflect/makro/runtime/Context.scala
+++ b/src/compiler/scala/reflect/makro/runtime/Context.scala
@@ -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
diff --git a/src/compiler/scala/reflect/makro/runtime/Util.scala b/src/compiler/scala/reflect/makro/runtime/ExprUtils.scala
index 09ed47efdd..4775138e5a 100644
--- a/src/compiler/scala/reflect/makro/runtime/Util.scala
+++ b/src/compiler/scala/reflect/makro/runtime/ExprUtils.scala
@@ -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)
diff --git a/src/compiler/scala/reflect/makro/runtime/Names.scala b/src/compiler/scala/reflect/makro/runtime/Names.scala
index 5b1a41a13d..3f43b15d90 100644
--- a/src/compiler/scala/reflect/makro/runtime/Names.scala
+++ b/src/compiler/scala/reflect/makro/runtime/Names.scala
@@ -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]
- }
} \ No newline at end of file
diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala
index 824f237948..7f255dab44 100644
--- a/src/compiler/scala/reflect/reify/Errors.scala
+++ b/src/compiler/scala/reflect/reify/Errors.scala
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import scala.reflect.makro.ReificationError
import scala.reflect.makro.UnexpectedReificationError
diff --git a/src/compiler/scala/reflect/reify/Phases.scala b/src/compiler/scala/reflect/reify/Phases.scala
index 54336ee708..1710cae2a5 100644
--- a/src/compiler/scala/reflect/reify/Phases.scala
+++ b/src/compiler/scala/reflect/reify/Phases.scala
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import phases._
diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala
index a5b2fef18c..00f25f0d8b 100644
--- a/src/compiler/scala/reflect/reify/Reifier.scala
+++ b/src/compiler/scala/reflect/reify/Reifier.scala
@@ -1,5 +1,4 @@
-package scala.reflect
-package reify
+package scala.reflect.reify
import scala.tools.nsc.Global
import scala.reflect.makro.ReificationError
diff --git a/src/compiler/scala/reflect/reify/phases/Reshape.scala b/src/compiler/scala/reflect/reify/phases/Reshape.scala
index 2a562d81e2..a508169019 100644
--- a/src/compiler/scala/reflect/reify/phases/Reshape.scala
+++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala
@@ -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
}
}
diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala
index 19a1526e67..c0d7441ad5 100644
--- a/src/compiler/scala/tools/ant/FastScalac.scala
+++ b/src/compiler/scala/tools/ant/FastScalac.scala
@@ -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;"+
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index 3c79fcd3fb..a34692f5e0 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -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)
diff --git a/src/compiler/scala/tools/cmd/CommandLine.scala b/src/compiler/scala/tools/cmd/CommandLine.scala
index ced3a97380..d9a74a698c 100644
--- a/src/compiler/scala/tools/cmd/CommandLine.scala
+++ b/src/compiler/scala/tools/cmd/CommandLine.scala
@@ -7,6 +7,7 @@ package scala.tools
package cmd
import scala.collection.mutable.ListBuffer
+import language.postfixOps
trait CommandLineConfig {
def enforceArity: Boolean = true
diff --git a/src/compiler/scala/tools/cmd/gen/Codegen.scala b/src/compiler/scala/tools/cmd/gen/Codegen.scala
index 1bb820455a..59b58563d1 100644
--- a/src/compiler/scala/tools/cmd/gen/Codegen.scala
+++ b/src/compiler/scala/tools/cmd/gen/Codegen.scala
@@ -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 { }
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 87072f3172..1835f645b8 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -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
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index f302318185..747e7ef989 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -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, _) =>
diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
index 12bba9c86a..faf80a39a7 100644
--- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
@@ -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.
*/
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index fde27a650a..ce16facf77 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -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 =>
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index d45db9ea5d..4504eaad38 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -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.
*
diff --git a/src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala b/src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala
index aebe3454b1..5802d36878 100644
--- a/src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/DestructureTypes.scala
@@ -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
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 9855284348..1ec4a7dc44 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -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 {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 93991fe7d5..7b55ea6c72 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -1103,34 +1103,36 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
else {
macroLogLite("typechecking macro expansion %s at %s".format(expandee, expandee.pos))
macroArgs(typer, expandee).fold(failExpansion(): MacroExpansionResult) {
- // [Eugene++] crashes virtpatmat:
- // case args @ ((context: MacroContext) :: _) =>
- case args @ (context0 :: _) =>
- val context = context0.asInstanceOf[MacroContext]
- if (nowDelayed) {
- macroLogLite("macro expansion is delayed: %s".format(expandee))
- delayed += expandee -> undetparams
- // need to save typer context for `macroExpandAll`
- // need to save macro context to preserve enclosures
- expandee addAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(context.asInstanceOf[MacroContext]))
- Delay(expandee)
- }
- else {
- // adding stuff to openMacros is easy, but removing it is a nightmare
- // it needs to be sprinkled over several different code locations
- // why? https://github.com/scala/scala/commit/bd3eacbae21f39b1ac7fe8ade4ed71fa98e1a28d#L2R1137
- // todo. will be improved
- openMacros ::= context
- var isSuccess = false
- try performExpansion(args) match {
- case x: Success => isSuccess = true ; x
- case x => x
+ args => (args: @unchecked) match {
+ // [Eugene++] crashes virtpatmat:
+ // case args @ ((context: MacroContext) :: _) =>
+ case args @ (context0 :: _) =>
+ val context = context0.asInstanceOf[MacroContext]
+ if (nowDelayed) {
+ macroLogLite("macro expansion is delayed: %s".format(expandee))
+ delayed += expandee -> undetparams
+ // need to save typer context for `macroExpandAll`
+ // need to save macro context to preserve enclosures
+ expandee addAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(context.asInstanceOf[MacroContext]))
+ Delay(expandee)
}
- finally {
- expandee.removeAttachment[MacroRuntimeAttachment]
- if (!isSuccess) openMacros = openMacros.tail
+ else {
+ // adding stuff to openMacros is easy, but removing it is a nightmare
+ // it needs to be sprinkled over several different code locations
+ // why? https://github.com/scala/scala/commit/bd3eacbae21f39b1ac7fe8ade4ed71fa98e1a28d#L2R1137
+ // todo. will be improved
+ openMacros ::= context
+ var isSuccess = false
+ try performExpansion(args) match {
+ case x: Success => isSuccess = true ; x
+ case x => x
+ }
+ finally {
+ expandee.removeAttachment[MacroRuntimeAttachment]
+ if (!isSuccess) openMacros = openMacros.tail
+ }
}
- }
+ }
}
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 30202ed3b5..f46d161da5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3644,7 +3644,7 @@ trait Typers extends Modes with Adaptations with Tags {
case t => (t, Nil)
}
- @inline def hasNamedArg(as: List[Tree]) = as collectFirst {case AssignOrNamedArg(lhs, rhs) =>} nonEmpty
+ @inline def hasNamedArg(as: List[Tree]) = as.collectFirst{case AssignOrNamedArg(lhs, rhs) =>}.nonEmpty
// note: context.tree includes at most one Apply node
// thus, we can't use it to detect we're going to receive named args in expressions such as:
@@ -3664,7 +3664,7 @@ trait Typers extends Modes with Adaptations with Tags {
}
val dynSel = Select(qual, oper)
- val tappSel = if (explicitTargs nonEmpty) TypeApply(dynSel, explicitTargs) else dynSel
+ val tappSel = if (explicitTargs.nonEmpty) TypeApply(dynSel, explicitTargs) else dynSel
atPos(qual.pos)(Apply(tappSel, List(Literal(Constant(name.decode)))))
}
@@ -4874,6 +4874,7 @@ trait Typers extends Modes with Adaptations with Tags {
}
case ApplyDynamic(qual, args) =>
+ assert(phase.erasedTypes)
val reflectiveCalls = !(settings.refinementMethodDispatch.value == "invoke-dynamic")
val qual1 = typed(qual, AnyRefClass.tpe)
val args1 = args mapConserve (arg => if (reflectiveCalls) typed(arg, AnyRefClass.tpe) else typed(arg))
diff --git a/src/compiler/scala/tools/reflect/WrappedProperties.scala b/src/compiler/scala/tools/reflect/WrappedProperties.scala
index 2ca374cf01..45c1b57d71 100644
--- a/src/compiler/scala/tools/reflect/WrappedProperties.scala
+++ b/src/compiler/scala/tools/reflect/WrappedProperties.scala
@@ -21,8 +21,8 @@ trait WrappedProperties extends PropertiesTrait {
override def propIsSet(name: String) = wrap(super.propIsSet(name)) exists (x => x)
override def propOrElse(name: String, alt: String) = wrap(super.propOrElse(name, alt)) getOrElse alt
- override def setProp(name: String, value: String) = wrap(super.setProp(name, value)) orNull
- override def clearProp(name: String) = wrap(super.clearProp(name)) orNull
+ override def setProp(name: String, value: String) = wrap(super.setProp(name, value)).orNull
+ override def clearProp(name: String) = wrap(super.clearProp(name)).orNull
override def envOrElse(name: String, alt: String) = wrap(super.envOrElse(name, alt)) getOrElse alt
override def envOrNone(name: String) = wrap(super.envOrNone(name)).flatten
diff --git a/src/compiler/scala/tools/util/Javap.scala b/src/compiler/scala/tools/util/Javap.scala
index 42d8a910f0..f4f218350a 100644
--- a/src/compiler/scala/tools/util/Javap.scala
+++ b/src/compiler/scala/tools/util/Javap.scala
@@ -12,6 +12,7 @@ import scala.tools.nsc.util.ScalaClassLoader
import java.io.{ InputStream, PrintWriter, ByteArrayInputStream, FileNotFoundException }
import scala.tools.nsc.io.File
import Javap._
+import language.reflectiveCalls
trait Javap {
def loader: ScalaClassLoader
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala
index 788891a062..4c0e33e4fb 100644
--- a/src/compiler/scala/tools/util/PathResolver.scala
+++ b/src/compiler/scala/tools/util/PathResolver.scala
@@ -13,6 +13,7 @@ import nsc.util.{ ClassPath, JavaClassPath, ScalaClassLoader }
import nsc.io.{ File, Directory, Path, AbstractFile }
import ClassPath.{ JavaContext, DefaultJavaContext, join, split }
import PartialFunction.condOpt
+import language.postfixOps
// Loosely based on the draft specification at:
// https://wiki.scala-lang.org/display/SW/Classpath