diff options
Diffstat (limited to 'src')
9 files changed, 23 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 1b6443a4cb..f3a22a2cee 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -1340,6 +1340,7 @@ trait Contexts { self: Analyzer => } object ContextMode { + import scala.language.implicitConversions private implicit def liftIntBitsToContextState(bits: Int): ContextMode = apply(bits) def apply(bits: Int): ContextMode = new ContextMode(bits) final val NOmode: ContextMode = 0 diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 06892053fa..8ca0d82e93 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -700,7 +700,7 @@ trait Infer extends Checkable { tp nonPrivateMember nme.apply match { case NoSymbol => tp case sym if !sym.isOverloaded && sym.isPublic => OverloadedType(tp, sym.alternatives) - case sym => OverloadedType(tp, sym filter (_.isPublic) alternatives) + case sym => OverloadedType(tp, sym.filter(_.isPublic).alternatives) } } diff --git a/src/library/scala/collection/parallel/mutable/LazyCombiner.scala b/src/library/scala/collection/parallel/mutable/LazyCombiner.scala index cc25b5b4b2..5ab2bb81c6 100644 --- a/src/library/scala/collection/parallel/mutable/LazyCombiner.scala +++ b/src/library/scala/collection/parallel/mutable/LazyCombiner.scala @@ -30,6 +30,7 @@ trait LazyCombiner[Elem, +To, Buff <: Growable[Elem] with Sizing] extends Combin def result: To = allocateAndCopy def clear() = { chain.clear() } def combine[N <: Elem, NewTo >: To](other: Combiner[N, NewTo]): Combiner[N, NewTo] = if (this ne other) { + import language.existentials // FIXME: See SI-7750 if (other.isInstanceOf[LazyCombiner[_, _, _]]) { val that = other.asInstanceOf[LazyCombiner[Elem, To, Buff]] newLazyCombiner(chain ++= that.chain) diff --git a/src/reflect/scala/reflect/internal/Kinds.scala b/src/reflect/scala/reflect/internal/Kinds.scala index 46a95c7d26..315bf7e9c4 100644 --- a/src/reflect/scala/reflect/internal/Kinds.scala +++ b/src/reflect/scala/reflect/internal/Kinds.scala @@ -233,7 +233,7 @@ trait Kinds { /** * The data structure describing the kind of a given type. - * + * * Proper types are represented using ProperTypeKind. * * Type constructors are reprented using TypeConKind. @@ -251,7 +251,7 @@ trait Kinds { * it uses prescribed letters for each level: A, F, X, Y, Z. */ def scalaNotation: String - + /** Kind notation used in http://adriaanm.github.com/files/higher.pdf. * Proper types are expressed as *. * Type constructors are expressed * -> *(lo, hi) -(+)-> *. @@ -261,13 +261,13 @@ trait Kinds { /** Contains bounds either as part of itself or its arguments. */ def hasBounds: Boolean = !bounds.isEmptyBounds - + private[internal] def buildState(sym: Symbol, v: Variance)(s: StringState): StringState } object Kind { private[internal] sealed trait ScalaNotation private[internal] sealed case class Head(order: Int, n: Option[Int], alias: Option[String]) extends ScalaNotation { - override def toString: String = { + override def toString: String = { alias getOrElse { typeAlias(order) + n.map(_.toString).getOrElse("") } @@ -285,7 +285,7 @@ trait Kinds { } private[internal] sealed case class Text(value: String) extends ScalaNotation { override def toString: String = value - } + } private[internal] case class StringState(tokens: Seq[ScalaNotation]) { override def toString: String = tokens.mkString def append(value: String): StringState = StringState(tokens :+ Text(value)) @@ -310,7 +310,7 @@ trait Kinds { ts map { case Head(`o`, _, a) => Head(o, None, a) case t => t - } + } else ts }) } @@ -332,7 +332,7 @@ trait Kinds { val order = 0 private[internal] def buildState(sym: Symbol, v: Variance)(s: StringState): StringState = { s.append(v.symbolicString).appendHead(order, sym).append(bounds.scalaNotation(_.toString)) - } + } def scalaNotation: String = Kind.Head(order, None, None) + bounds.scalaNotation(_.toString) def starNotation: String = "*" + bounds.starNotation(_.toString) } @@ -344,7 +344,7 @@ trait Kinds { class TypeConKind(val bounds: TypeBounds, val args: Seq[TypeConKind.Argument]) extends Kind { import Kind.StringState - val order = (args map {_.kind.order} max) + 1 + val order = (args map (_.kind.order)).max + 1 def description: String = if (order == 1) "This is a type constructor: a 1st-order-kinded type." else "This is a type constructor that takes type constructor(s): a higher-kinded type." @@ -389,7 +389,7 @@ trait Kinds { */ object inferKind { import TypeConKind.Argument - + abstract class InferKind { protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind protected def infer(sym: Symbol, topLevel: Boolean): Kind = infer(sym.tpeHK, sym.owner, topLevel) @@ -398,7 +398,7 @@ trait Kinds { } def apply(pre: Type): InferKind = new InferKind { - protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind = { + protected def infer(tpe: Type, owner: Symbol, topLevel: Boolean): Kind = { val bounds = if (topLevel) TypeBounds.empty else tpe.asSeenFrom(pre, owner).bounds if(!tpe.isHigherKinded) ProperTypeKind(bounds) diff --git a/src/reflect/scala/reflect/internal/transform/Erasure.scala b/src/reflect/scala/reflect/internal/transform/Erasure.scala index 580ada8254..90ffe9d9e7 100644 --- a/src/reflect/scala/reflect/internal/transform/Erasure.scala +++ b/src/reflect/scala/reflect/internal/transform/Erasure.scala @@ -60,7 +60,7 @@ trait Erasure { */ protected def unboundedGenericArrayLevel(tp: Type): Int = tp match { case GenericArray(level, core) if !(core <:< AnyRefTpe) => level - case RefinedType(ps, _) if ps.nonEmpty => logResult(s"Unbounded generic level for $tp is")(ps map unboundedGenericArrayLevel max) + case RefinedType(ps, _) if ps.nonEmpty => logResult(s"Unbounded generic level for $tp is")((ps map unboundedGenericArrayLevel).max) case _ => 0 } diff --git a/src/reflect/scala/reflect/internal/util/ScalaClassLoader.scala b/src/reflect/scala/reflect/internal/util/ScalaClassLoader.scala index a7fd787dfc..63ea6e2c49 100644 --- a/src/reflect/scala/reflect/internal/util/ScalaClassLoader.scala +++ b/src/reflect/scala/reflect/internal/util/ScalaClassLoader.scala @@ -44,7 +44,7 @@ trait ScalaClassLoader extends JClassLoader { /** Create an instance of a class with this classloader */ def create(path: String): AnyRef = - tryToInitializeClass[AnyRef](path) map (_.newInstance()) orNull + tryToInitializeClass[AnyRef](path).map(_.newInstance()).orNull /** The actual bytes for a class file, or an empty array if it can't be found. */ def classBytes(className: String): Array[Byte] = classAsStream(className) match { @@ -116,7 +116,7 @@ object ScalaClassLoader { /** True if supplied class exists in supplied path */ def classExists(urls: Seq[URL], name: String): Boolean = - fromURLs(urls) tryToLoadClass name isDefined + (fromURLs(urls) tryToLoadClass name).isDefined /** Finding what jar a clazz or instance came from */ def originOfClass(x: Class[_]): Option[URL] = diff --git a/src/reflect/scala/reflect/internal/util/TriState.scala b/src/reflect/scala/reflect/internal/util/TriState.scala index c7a35d4637..4074d974d2 100644 --- a/src/reflect/scala/reflect/internal/util/TriState.scala +++ b/src/reflect/scala/reflect/internal/util/TriState.scala @@ -3,6 +3,8 @@ package reflect package internal package util +import scala.language.implicitConversions + import TriState._ /** A simple true/false/unknown value, for those days when diff --git a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala index c4e3c115be..8f217e087c 100644 --- a/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala @@ -305,10 +305,9 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { else None } + private def templateAndType(ancestor: Symbol): (TemplateImpl, TypeEntity) = (makeTemplate(ancestor), makeType(reprSymbol.info.baseType(ancestor), this)) lazy val (linearizationTemplates, linearizationTypes) = - reprSymbol.ancestors map { ancestor => - (makeTemplate(ancestor), makeType(reprSymbol.info.baseType(ancestor), this)) - } unzip + (reprSymbol.ancestors map templateAndType).unzip /* Subclass cache */ private lazy val subClassesCache = ( @@ -321,7 +320,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { } def directSubClasses = if (subClassesCache == null) Nil else subClassesCache.toList - /* Implcitly convertible class cache */ + /* Implicitly convertible class cache */ private var implicitlyConvertibleClassesCache: mutable.ListBuffer[(DocTemplateImpl, ImplicitConversionImpl)] = null def registerImplicitlyConvertibleClass(dtpl: DocTemplateImpl, conv: ImplicitConversionImpl): Unit = { if (implicitlyConvertibleClassesCache == null) @@ -841,7 +840,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { def value = tree } } - case None => + case None => argTrees map { tree => new ValueArgument { def parameter = None diff --git a/src/xml/scala/xml/Elem.scala b/src/xml/scala/xml/Elem.scala index 484cf98744..e9b87e516c 100755 --- a/src/xml/scala/xml/Elem.scala +++ b/src/xml/scala/xml/Elem.scala @@ -37,6 +37,7 @@ object Elem { } import scala.sys.process._ + import scala.language.implicitConversions /** Implicitly convert a [[scala.xml.Elem]] into a * [[scala.sys.process.ProcessBuilder]]. This is done by obtaining the text * elements of the element, trimming spaces, and then converting the result |