summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc')
-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
9 files changed, 40 insertions, 33 deletions
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))