Permalink
Browse files

Eliminated the accumulated feature warnings.

No, this isn't busywork, how dare you suggest
such a thing. I intend my tombstone to say

           HERE LIES EXTEMPORE,
  WHO ELIMINATED A LOT OF SIP-18 WARNINGS
             REST IN PEACE
  • Loading branch information...
1 parent 1da48a4 commit cdffcf8962c9fa606c027fcb5a50a4273976a576 @paulp paulp committed Apr 23, 2013
@@ -5,6 +5,8 @@
package scala.tools
package nsc
+import scala.language.postfixOps
+
/** The main class for NSC, a compiler for the programming
* language Scala.
*/
@@ -13,6 +13,7 @@ import scala.annotation.{ switch, tailrec }
import scala.collection.{ mutable, immutable }
import mutable.{ ListBuffer, ArrayBuffer }
import scala.xml.Utility.{ isNameStart }
+import scala.language.postfixOps
/** See Parsers.scala / ParsersCommon for some explanation of ScannersCommon.
*/
@@ -10,7 +10,7 @@ import java.io.{ InputStream, OutputStream, IOException, FileNotFoundException,
import java.util.jar._
import scala.collection.JavaConverters._
import Attributes.Name
-import scala.language.implicitConversions
+import scala.language.{ implicitConversions, postfixOps }
// Attributes.Name instances:
//
@@ -8,6 +8,7 @@ package scala.tools.nsc.transform.patmat
import scala.collection.mutable
import scala.reflect.internal.util.Statistics
+import scala.language.postfixOps
// naive CNF translation and simple DPLL solver
trait Solving extends Logic {
@@ -9,6 +9,7 @@ package typechecker
import scala.collection.mutable
import scala.annotation.tailrec
import symtab.Flags._
+import scala.language.postfixOps
/** This trait declares methods to create symbols and to enter them into scopes.
*
@@ -9,6 +9,7 @@ package typechecker
import scala.collection.{ mutable, immutable }
import symtab.Flags._
import scala.collection.mutable.ListBuffer
+import scala.language.postfixOps
/** Synthetic method implementations for case classes and case objects.
*
@@ -153,7 +153,7 @@ trait TypeStrings {
private type JClass = java.lang.Class[_]
private val ObjectClass = classOf[java.lang.Object]
private val primitives = Set[String]("byte", "char", "short", "int", "long", "float", "double", "boolean", "void")
- private val primitiveMap = primitives.toList map { x =>
+ private val primitiveMap = (primitives.toList map { x =>
val key = x match {
case "int" => "Integer"
case "char" => "Character"
@@ -165,7 +165,7 @@ trait TypeStrings {
}
("java.lang." + key) -> ("scala." + value)
- } toMap
+ }).toMap
def isAnonClass(cl: Class[_]) = {
val xs = cl.getName.reverse takeWhile (_ != '$')
@@ -3963,7 +3963,7 @@ trait Typers extends Adaptations with Tags {
case Apply(fn, args) if matches(fn) => Some((applyOp(args), fn))
case Assign(lhs, _) if matches(lhs) => Some((nme.updateDynamic, lhs))
case _ if matches(t) => Some((nme.selectDynamic, t))
- case _ => t.children flatMap findSelection headOption
+ case _ => (t.children flatMap findSelection).headOption
}
findSelection(cxTree) match {
case Some((opName, treeInfo.Applied(_, targs, _))) =>
@@ -26,7 +26,7 @@ trait FastTrack {
final class FastTrackEntry(pf: PartialFunction[Applied, MacroContext => Tree]) extends (MacroArgs => Any) {
def validate(tree: Tree) = pf isDefinedAt Applied(tree)
- def apply(margs: MacroArgs) = {
+ def apply(margs: MacroArgs): margs.c.Expr[Nothing] = {
val MacroArgs(c, _) = margs
// Macros validated that the pf is defined here - and there's not much we could do if it weren't.
c.Expr[Nothing](pf(Applied(c.expandee))(c))(c.WeakTypeTag.Nothing)
@@ -3,7 +3,7 @@ package scala.tools.util
import scala.tools.nsc.io._
import java.net.URLClassLoader
import scala.collection.JavaConverters._
-
+import scala.language.postfixOps
object VerifyClass {
@@ -8,6 +8,7 @@
package scala.collection
+import scala.language.implicitConversions
import scala.annotation.tailrec
import scala.collection.generic.IsSeqLike
import scala.math.Ordering
@@ -50,7 +51,7 @@ object Searching {
* sequence, or the `InsertionPoint` where the element would be inserted if
* the element is not in the sequence.
*/
- final def search[B >: A](elem: B)(implicit ord: Ordering[B]): SearchResult =
+ final def search[B >: A](elem: B)(implicit ord: Ordering[B]): SearchResult =
coll match {
case _: IndexedSeq[A] => binarySearch(elem, -1, coll.length)(ord)
case _ => linearSearch(coll.view, elem, 0)(ord)
@@ -77,7 +78,7 @@ object Searching {
* the element is not in the sequence.
*/
final def search[B >: A](elem: B, from: Int, to: Int)
- (implicit ord: Ordering[B]): SearchResult =
+ (implicit ord: Ordering[B]): SearchResult =
coll match {
case _: IndexedSeq[A] => binarySearch(elem, from-1, to)(ord)
case _ => linearSearch(coll.view(from, to), elem, from)(ord)
@@ -10,6 +10,7 @@ package scala.concurrent.duration
import java.lang.{ Double => JDouble, Long => JLong }
import scala.language.implicitConversions
+import scala.language.postfixOps
object Duration {
@@ -30,7 +30,7 @@ private[scala] class ExecutionContextImpl private[impl] (es: Executor, reporter:
}
// Implement BlockContext on FJP threads
- class DefaultThreadFactory(daemonic: Boolean) extends ThreadFactory with ForkJoinPool.ForkJoinWorkerThreadFactory {
+ class DefaultThreadFactory(daemonic: Boolean) extends ThreadFactory with ForkJoinPool.ForkJoinWorkerThreadFactory {
def wire[T <: Thread](thread: T): T = {
thread.setDaemon(daemonic)
thread.setUncaughtExceptionHandler(uncaughtExceptionHandler)
@@ -72,7 +72,7 @@ private[scala] class ExecutionContextImpl private[impl] (es: Executor, reporter:
getInt("scala.concurrent.context.maxThreads", _.toInt))
val threadFactory = new DefaultThreadFactory(daemonic = true)
-
+
try {
new ForkJoinPool(
desiredParallelism,
@@ -98,13 +98,13 @@ private[scala] class ExecutionContextImpl private[impl] (es: Executor, reporter:
def execute(runnable: Runnable): Unit = executor match {
case fj: ForkJoinPool =>
- val fjt = runnable match {
+ val fjt: ForkJoinTask[_] = runnable match {
case t: ForkJoinTask[_] => t
- case r => new ExecutionContextImpl.AdaptedForkJoinTask(r)
+ case r => new ExecutionContextImpl.AdaptedForkJoinTask(r)
}
Thread.currentThread match {
case fjw: ForkJoinWorkerThread if fjw.getPool eq fj => fjt.fork()
- case _ => fj execute fjt
+ case _ => fj execute fjt
}
case generic => generic execute runnable
}
@@ -1,6 +1,8 @@
package scala.reflect
package api
+import scala.language.implicitConversions
+
/**
* <span class="badge badge-red" style="float: right;">EXPERIMENTAL</span>
*
@@ -6,6 +6,7 @@
package scala.reflect
package internal
+import scala.language.postfixOps
import scala.annotation.{ switch, meta }
import scala.collection.{ mutable, immutable }
import Flags._
@@ -5,6 +5,7 @@
package scala.reflect
package internal
+import scala.language.implicitConversions
import java.lang.{ Class => jClass }
import java.lang.annotation.{ Annotation => jAnnotation }
import java.lang.reflect.{
@@ -6,6 +6,8 @@
package scala.reflect
package internal
+import scala.language.implicitConversions
+
object Mode {
private implicit def liftIntBitsToMode(bits: Int): Mode = apply(bits)
def apply(bits: Int): Mode = new Mode(bits)
@@ -2,6 +2,8 @@ package scala
package reflect
package internal
+import scala.language.existentials // SI-6541
+
package object util {
import StringOps.longestCommonPrefix
@@ -25,11 +27,10 @@ package object util {
if (isModule)
(name split '$' filterNot (_ == "")).last + "$"
- else if (isAnon) {
- val parents = clazz.getSuperclass :: clazz.getInterfaces.toList
- parents map (c => shortClass(c)) mkString " with "
- }
- else shortenName(name)
+ else if (isAnon)
+ clazz.getSuperclass :: clazz.getInterfaces.toList map (c => shortClass(c)) mkString " with "
+ else
+ shortenName(name)
}
/**
* Adds the `sm` String interpolator to a [[scala.StringContext]].
@@ -1,6 +1,8 @@
package scala.reflect
package macros
+import scala.language.existentials // SI-6541
+
/**
* <span class="badge badge-red" style="float: right;">EXPERIMENTAL</span>
*
@@ -100,4 +102,4 @@ trait Enclosures {
*/
case class EnclosureException(expected: Class[_], enclosingTrees: List[Tree])
extends Exception(s"Couldn't find a tree of type $expected among enclosing trees $enclosingTrees")
-}
+}
@@ -29,6 +29,7 @@ import java.util.concurrent.Future
import scala.reflect.runtime.{ universe => ru }
import scala.reflect.{ ClassTag, classTag }
import StdReplTags._
+import scala.language.implicitConversions
/** An interpreter for Scala code.
*
@@ -11,6 +11,8 @@ import scala.reflect.internal.Chars._
import symtab._
import typechecker.Analyzer
import scala.reflect.internal.util.{ BatchSourceFile, RangePosition }
+import scala.tools.nsc.doc.base.{ CommentFactoryBase, MemberLookupBase, LinkTo, LinkToExternal }
+import scala.language.postfixOps
trait ScaladocAnalyzer extends Analyzer {
val global : Global // generally, a ScaladocGlobal
@@ -151,27 +153,25 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax
private var docBuffer: StringBuilder = null // buffer for comments (non-null while scanning)
private var inDocComment = false // if buffer contains double-star doc comment
- private var lastDoc: DocComment = null // last comment if it was double-star doc
+ private var lastDoc: DocComment = null // last comment if it was double-star doc
- private lazy val unmooredParser = { // minimalist comment parser
- import scala.tools.nsc.doc.base.{comment => _, _}
- new {
- val global: Global = ScaladocSyntaxAnalyzer.this.global
- } with CommentFactoryBase with MemberLookupBase {
- import global.{ settings, Symbol }
- def parseComment(comment: DocComment) = {
- val nowarnings = settings.nowarn.value
- settings.nowarn.value = true
- try parseAtSymbol(comment.raw, comment.raw, comment.pos)
- finally settings.nowarn.value = nowarnings
- }
-
- override def internalLink(sym: Symbol, site: Symbol): Option[LinkTo] = None
- override def chooseLink(links: List[LinkTo]): LinkTo = links.headOption orNull
- override def toString(link: LinkTo): String = "No link"
- override def findExternalLink(sym: Symbol, name: String): Option[LinkToExternal] = None
- override def warnNoLink: Boolean = false
+ private object unmooredParser extends { // minimalist comment parser
+ val global: Global = ScaladocSyntaxAnalyzer.this.global
+ }
+ with CommentFactoryBase with MemberLookupBase {
+ import global.{ settings, Symbol }
+ def parseComment(comment: DocComment) = {
+ val nowarnings = settings.nowarn.value
+ settings.nowarn.value = true
+ try parseAtSymbol(comment.raw, comment.raw, comment.pos)
+ finally settings.nowarn.value = nowarnings
}
+
+ override def internalLink(sym: Symbol, site: Symbol): Option[LinkTo] = None
+ override def chooseLink(links: List[LinkTo]): LinkTo = links.headOption orNull
+ override def toString(link: LinkTo): String = "No link"
+ override def findExternalLink(sym: Symbol, name: String): Option[LinkToExternal] = None
+ override def warnNoLink: Boolean = false
}
/**

0 comments on commit cdffcf8

Please sign in to comment.