diff options
Diffstat (limited to 'src')
68 files changed, 235 insertions, 775 deletions
diff --git a/src/compiler/scala/reflect/macros/contexts/Reifiers.scala b/src/compiler/scala/reflect/macros/contexts/Reifiers.scala index ecef1c7289..010829f6ab 100644 --- a/src/compiler/scala/reflect/macros/contexts/Reifiers.scala +++ b/src/compiler/scala/reflect/macros/contexts/Reifiers.scala @@ -61,9 +61,9 @@ trait Reifiers { // logging free vars only when they are untyped prevents avalanches of duplicate messages symtab.syms map (sym => symtab.symDef(sym)) foreach { case FreeTermDef(_, _, binding, _, origin) if universe.settings.logFreeTerms && binding.tpe == null => - reporter.echo(position, "free term: %s %s".format(showRaw(binding), origin)) + reporter.echo(position, s"free term: ${showRaw(binding)} $origin") case FreeTypeDef(_, _, binding, _, origin) if universe.settings.logFreeTypes && binding.tpe == null => - reporter.echo(position, "free type: %s %s".format(showRaw(binding), origin)) + reporter.echo(position, s"free type: ${showRaw(binding)} $origin") case _ => // do nothing } diff --git a/src/compiler/scala/reflect/macros/contexts/Typers.scala b/src/compiler/scala/reflect/macros/contexts/Typers.scala index baf066c7d9..a0dfbf5df1 100644 --- a/src/compiler/scala/reflect/macros/contexts/Typers.scala +++ b/src/compiler/scala/reflect/macros/contexts/Typers.scala @@ -40,12 +40,12 @@ trait Typers { } def inferImplicitValue(pt: Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: Position = enclosingPosition): Tree = { - macroLogVerbose("inferring implicit value of type %s, macros = %s".format(pt, !withMacrosDisabled)) + macroLogVerbose(s"inferring implicit value of type $pt, macros = ${!withMacrosDisabled}") universe.analyzer.inferImplicit(universe.EmptyTree, pt, false, callsiteTyper.context, silent, withMacrosDisabled, pos, (pos, msg) => throw TypecheckException(pos, msg)) } def inferImplicitView(tree: Tree, from: Type, to: Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: Position = enclosingPosition): Tree = { - macroLogVerbose("inferring implicit view from %s to %s for %s, macros = %s".format(from, to, tree, !withMacrosDisabled)) + macroLogVerbose(s"inferring implicit view from $from to $to for $tree, macros = ${!withMacrosDisabled}") val viewTpe = universe.appliedType(universe.definitions.FunctionClass(1).toTypeConstructor, List(from, to)) universe.analyzer.inferImplicit(tree, viewTpe, true, callsiteTyper.context, silent, withMacrosDisabled, pos, (pos, msg) => throw TypecheckException(pos, msg)) } diff --git a/src/compiler/scala/reflect/macros/runtime/MacroRuntimes.scala b/src/compiler/scala/reflect/macros/runtime/MacroRuntimes.scala index d4b8175d28..7e700a524c 100644 --- a/src/compiler/scala/reflect/macros/runtime/MacroRuntimes.scala +++ b/src/compiler/scala/reflect/macros/runtime/MacroRuntimes.scala @@ -4,7 +4,6 @@ package runtime import java.net.URLClassLoader import scala.reflect.internal.Flags._ -import scala.reflect.internal.util.ScalaClassLoader import scala.reflect.runtime.ReflectionUtils import scala.reflect.internal.util.AbstractFileClassLoader @@ -84,4 +83,4 @@ trait MacroRuntimes extends JavaReflectionRuntimes { } } } -}
\ No newline at end of file +} diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala index e0b7be8004..3b62c493d3 100644 --- a/src/compiler/scala/tools/ant/FastScalac.scala +++ b/src/compiler/scala/tools/ant/FastScalac.scala @@ -109,7 +109,7 @@ class FastScalac extends Scalac { List( /*scalac*/ s.debuginfo, s.target - ) filter (x => x.value != x.default) map (x => "%s:%s".format(x.name, x.value)) + ) filter (x => x.value != x.default) map (x => s"${x.name}:${x.value}") val booleanSettings = List( @@ -129,7 +129,7 @@ class FastScalac extends Scalac { val phaseSetting = { val s = settings.log if (s.value.isEmpty) Nil - else List("%s:%s".format(s.name, s.value.mkString(","))) + else List(s"${s.name}:${s.value.mkString(",")}") } val fscOptions = @@ -147,8 +147,7 @@ class FastScalac extends Scalac { case cl: AntClassLoader => path add new Path(getProject, cl.getClasspath) case _ => - buildError("Compilation failed because of an internal compiler error;"+ - " see the error output for details.") + buildError("Compilation failed because of an internal compiler error; see the error output for details.") } path } @@ -160,8 +159,7 @@ class FastScalac extends Scalac { File(url.getFile).jfile.getParentFile.getParentFile.getAbsolutePath } catch { case _: Throwable => - buildError("Compilation failed because of an internal compiler error;"+ - " couldn't determine value for -Dscala.home=<value>") + buildError("Compilation failed because of an internal compiler error; couldn't determine value for -Dscala.home=<value>") } java.createJvmarg() setValue "-Dscala.usejavacp=true" java.createJvmarg() setValue ("-Dscala.home="+scalaHome) @@ -186,7 +184,6 @@ class FastScalac extends Scalac { val res = execWithArgFiles(java, paths) if (failonerror && res != 0) - buildError("Compilation failed because of an internal compiler error;"+ - " see the error output for details.") + buildError("Compilation failed because of an internal compiler error; see the error output for details.") } } diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index fe9815be20..930163af36 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -551,7 +551,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared { val str = if (javaFiles.isEmpty) "%d source file%s".format(list.length, plural(list)) else "%d scala and %d java source files".format(scalaFiles.length, javaFiles.length) - log("Compiling %s to %s".format(str, getDestination.toString)) + log(s"Compiling $str to $getDestination") } else log("No files selected for compilation", Project.MSG_VERBOSE) diff --git a/src/compiler/scala/tools/cmd/CommandLine.scala b/src/compiler/scala/tools/cmd/CommandLine.scala index 781cc564cb..3a36a7d345 100644 --- a/src/compiler/scala/tools/cmd/CommandLine.scala +++ b/src/compiler/scala/tools/cmd/CommandLine.scala @@ -51,7 +51,7 @@ class CommandLine(val spec: Reference, val originalArgs: List[String]) extends C /* Assumes known options have all been ruled out already. */ def isUnknown(opt: String) = onlyKnownOptions && (opt startsWith "-") && { - errorFn("Option '%s' not recognized.".format(opt)) + errorFn(s"Option '$opt' not recognized.") true } @@ -61,7 +61,7 @@ class CommandLine(val spec: Reference, val originalArgs: List[String]) extends C case x :: Nil => expand(x) foreach (exp => return loop(exp)) if (isBinaryOption(x) && enforceArity) - errorFn("Option '%s' requires argument, found EOF instead.".format(x)) + errorFn(s"Option '$x' requires argument, found EOF instead.") if (isUnaryOption(x)) mapForUnary(x) else if (isUnknown(x)) Map() diff --git a/src/compiler/scala/tools/cmd/Opt.scala b/src/compiler/scala/tools/cmd/Opt.scala index df3d0c4462..70756c5bb2 100644 --- a/src/compiler/scala/tools/cmd/Opt.scala +++ b/src/compiler/scala/tools/cmd/Opt.scala @@ -20,7 +20,7 @@ object Opt { self: Implicit => protected def fail(msg: String) = runAndExit(println(programInfo.runner + ": " + msg)) - protected def failOption(arg: String, why: String) = fail("%s: '%s' is %s".format(opt, arg, why)) + protected def failOption(arg: String, why: String) = fail(s"$opt: '$arg' is $why") } trait Implicit { diff --git a/src/compiler/scala/tools/cmd/Reference.scala b/src/compiler/scala/tools/cmd/Reference.scala index 62b6c893cf..25a16b1e3e 100644 --- a/src/compiler/scala/tools/cmd/Reference.scala +++ b/src/compiler/scala/tools/cmd/Reference.scala @@ -70,18 +70,18 @@ object Reference { def addHelpAlias(f: () => String) = mapHelp { s => val str = "alias for '%s'" format f() def noHelp = (helpFormatStr.format("", "")).length == s.length - val str2 = if (noHelp) str else " (" + str + ")" + val str2 = if (noHelp) str else s" ($str)" s + str2 } def addHelpDefault(f: () => String): Unit = mapHelp { s => val str = "(default: %s)" format f() - if (s.length + str.length < MaxLine) s + " " + str + if (s.length + str.length < MaxLine) s"$s $str" else defaultFormatStr.format(s, str) } def addHelpEnvDefault(name: String): Unit = mapHelp { s => - val line1 = "%s (default: %s)".format(s, name) + val line1 = s"$s (default: $name)" val envNow = envOrNone(name) map ("'" + _ + "'") getOrElse "unset" val line2 = defaultFormatStr.format("Currently " + envNow) diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala deleted file mode 100644 index e78589908c..0000000000 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ /dev/null @@ -1,484 +0,0 @@ -/* NSC -- new Scala compiler - * Copyright 2007-2013 LAMP/EPFL - * @author Paul Phillips - */ - -package scala.tools.cmd -package gen - -/** Code generation of the AnyVal types and their companions. */ -trait AnyValReps { - self: AnyVals => - - sealed abstract class AnyValNum(name: String, repr: Option[String], javaEquiv: String) - extends AnyValRep(name,repr,javaEquiv) { - - case class Op(op : String, doc : String) - - private def companionCoercions(tos: AnyValRep*) = { - tos.toList map (to => - s"implicit def @javaequiv@2${to.javaEquiv}(x: @name@): ${to.name} = x.to${to.name}" - ) - } - def coercionComment = -"""/** Language mandated coercions from @name@ to "wider" types. */ -import scala.language.implicitConversions""" - - def implicitCoercions: List[String] = { - val coercions = this match { - case B => companionCoercions(S, I, L, F, D) - case S | C => companionCoercions(I, L, F, D) - case I => companionCoercions(L, F, D) - case L => companionCoercions(F, D) - case F => companionCoercions(D) - case _ => Nil - } - if (coercions.isEmpty) Nil - else coercionComment.lines.toList ++ coercions - } - - def isCardinal: Boolean = isIntegerType(this) - def unaryOps = { - val ops = List( - Op("+", "/** Returns this value, unmodified. */"), - Op("-", "/** Returns the negation of this value. */")) - - if(isCardinal) - Op("~", "/**\n" + - " * Returns the bitwise negation of this value.\n" + - " * @example {{{\n" + - " * ~5 == -6\n" + - " * // in binary: ~00000101 ==\n" + - " * // 11111010\n" + - " * }}}\n" + - " */") :: ops - else ops - } - - def bitwiseOps = - if (isCardinal) - List( - Op("|", "/**\n" + - " * Returns the bitwise OR of this value and `x`.\n" + - " * @example {{{\n" + - " * (0xf0 | 0xaa) == 0xfa\n" + - " * // in binary: 11110000\n" + - " * // | 10101010\n" + - " * // --------\n" + - " * // 11111010\n" + - " * }}}\n" + - " */"), - Op("&", "/**\n" + - " * Returns the bitwise AND of this value and `x`.\n" + - " * @example {{{\n" + - " * (0xf0 & 0xaa) == 0xa0\n" + - " * // in binary: 11110000\n" + - " * // & 10101010\n" + - " * // --------\n" + - " * // 10100000\n" + - " * }}}\n" + - " */"), - Op("^", "/**\n" + - " * Returns the bitwise XOR of this value and `x`.\n" + - " * @example {{{\n" + - " * (0xf0 ^ 0xaa) == 0x5a\n" + - " * // in binary: 11110000\n" + - " * // ^ 10101010\n" + - " * // --------\n" + - " * // 01011010\n" + - " * }}}\n" + - " */")) - else Nil - - def shiftOps = - if (isCardinal) - List( - Op("<<", "/**\n" + - " * Returns this value bit-shifted left by the specified number of bits,\n" + - " * filling in the new right bits with zeroes.\n" + - " * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}}\n" + - " */"), - - Op(">>>", "/**\n" + - " * Returns this value bit-shifted right by the specified number of bits,\n" + - " * filling the new left bits with zeroes.\n" + - " * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}}\n" + - " * @example {{{\n" + - " * -21 >>> 3 == 536870909\n" + - " * // in binary: 11111111 11111111 11111111 11101011 >>> 3 ==\n" + - " * // 00011111 11111111 11111111 11111101\n" + - " * }}}\n" + - " */"), - - Op(">>", "/**\n" + - " * Returns this value bit-shifted right by the specified number of bits,\n" + - " * filling in the left bits with the same value as the left-most bit of this.\n" + - " * The effect of this is to retain the sign of the value.\n" + - " * @example {{{\n" + - " * -21 >> 3 == -3\n" + - " * // in binary: 11111111 11111111 11111111 11101011 >> 3 ==\n" + - " * // 11111111 11111111 11111111 11111101\n" + - " * }}}\n" + - " */")) - else Nil - - def comparisonOps = List( - Op("==", "/** Returns `true` if this value is equal to x, `false` otherwise. */"), - Op("!=", "/** Returns `true` if this value is not equal to x, `false` otherwise. */"), - Op("<", "/** Returns `true` if this value is less than x, `false` otherwise. */"), - Op("<=", "/** Returns `true` if this value is less than or equal to x, `false` otherwise. */"), - Op(">", "/** Returns `true` if this value is greater than x, `false` otherwise. */"), - Op(">=", "/** Returns `true` if this value is greater than or equal to x, `false` otherwise. */")) - - def otherOps = List( - Op("+", "/** Returns the sum of this value and `x`. */"), - Op("-", "/** Returns the difference of this value and `x`. */"), - Op("*", "/** Returns the product of this value and `x`. */"), - Op("/", "/** Returns the quotient of this value and `x`. */"), - Op("%", "/** Returns the remainder of the division of this value by `x`. */")) - - // Given two numeric value types S and T , the operation type of S and T is defined as follows: - // If both S and T are subrange types then the operation type of S and T is Int. - // Otherwise the operation type of S and T is the larger of the two types wrt ranking. - // Given two numeric values v and w the operation type of v and w is the operation type - // of their run-time types. - def opType(that: AnyValNum): AnyValNum = { - val rank = IndexedSeq(I, L, F, D) - (rank indexOf this, rank indexOf that) match { - case (-1, -1) => I - case (r1, r2) => rank apply (r1 max r2) - } - } - - def mkCoercions = numeric map (x => "def to%s: %s".format(x, x)) - def mkUnaryOps = unaryOps map (x => "%s\n def unary_%s : %s".format(x.doc, x.op, this opType I)) - def mkStringOps = List("def +(x: String): String") - def mkShiftOps = ( - for (op <- shiftOps ; arg <- List(I, L)) yield - "%s\n def %s(x: %s): %s".format(op.doc, op.op, arg, this opType I) - ) - - def clumps: List[List[String]] = { - val xs1 = List(mkCoercions, mkUnaryOps, mkStringOps, mkShiftOps) map (xs => if (xs.isEmpty) xs else xs :+ "") - val xs2 = List( - mkBinOpsGroup(comparisonOps, numeric, _ => Z), - mkBinOpsGroup(bitwiseOps, cardinal, this opType _), - mkBinOpsGroup(otherOps, numeric, this opType _) - ) - xs1 ++ xs2 - } - def classLines = (clumps :+ commonClassLines).foldLeft(List[String]()) { - case (res, Nil) => res - case (res, lines) => - val xs = lines map { - case "" => "" - case s => interpolate(s) - } - res ++ xs - } - def objectLines = { - val comp = if (isCardinal) cardinalCompanion else floatingCompanion - interpolate(comp + allCompanions + "\n" + nonUnitCompanions).trim.lines.toList ++ (implicitCoercions map interpolate) - } - - /** Makes a set of binary operations based on the given set of ops, args, and resultFn. - * - * @param ops list of function names e.g. List(">>", "%") - * @param args list of types which should appear as arguments - * @param resultFn function which calculates return type based on arg type - * @return list of function definitions - */ - def mkBinOpsGroup(ops: List[Op], args: List[AnyValNum], resultFn: AnyValNum => AnyValRep): List[String] = ( - ops flatMap (op => - args.map(arg => - "%s\n def %s(x: %s): %s".format(op.doc, op.op, arg, resultFn(arg))) :+ "" - ) - ).toList - } - - sealed abstract class AnyValRep(val name: String, val repr: Option[String], val javaEquiv: String) { - def classLines: List[String] - def objectLines: List[String] - def commonClassLines = List( - "override def getClass(): Class[@name@] = null" - ) - - def lcname = name.toLowerCase - def boxedSimpleName = this match { - case C => "Character" - case I => "Integer" - case _ => name - } - def boxedName = this match { - case U => "scala.runtime.BoxedUnit" - case _ => "java.lang." + boxedSimpleName - } - def zeroRep = this match { - case L => "0L" - case F => "0.0f" - case D => "0.0d" - case _ => "0" - } - - def representation = repr.map(", a " + _).getOrElse("") - - def indent(s: String) = if (s == "") "" else " " + s - def indentN(s: String) = s.lines map indent mkString "\n" - - def boxUnboxImpls = Map( - "@boxRunTimeDoc@" -> """ - * Runtime implementation determined by `scala.runtime.BoxesRunTime.boxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. - *""".format(boxedSimpleName), - "@boxImpl@" -> "%s.valueOf(x)".format(boxedName), - "@unboxRunTimeDoc@" -> """ - * Runtime implementation determined by `scala.runtime.BoxesRunTime.unboxTo%s`. See [[https://github.com/scala/scala src/library/scala/runtime/BoxesRunTime.java]]. - *""".format(name), - "@unboxImpl@" -> "x.asInstanceOf[%s].%sValue()".format(boxedName, lcname), - "@unboxDoc@" -> "the %s resulting from calling %sValue() on `x`".format(name, lcname) - ) - def interpolations = Map( - "@name@" -> name, - "@representation@" -> representation, - "@javaequiv@" -> javaEquiv, - "@boxed@" -> boxedName, - "@lcname@" -> lcname, - "@zero@" -> zeroRep - ) ++ boxUnboxImpls - - def interpolate(s: String): String = interpolations.foldLeft(s) { - case (str, (key, value)) => str.replaceAll(key, value) - } - def classDoc = interpolate(classDocTemplate) - def objectDoc = "" - def mkImports = "" - - def mkClass = assemble("final abstract class " + name + " private extends AnyVal", classLines) - def mkObject = assemble("object " + name + " extends AnyValCompanion", objectLines) - def make() = List[String]( - headerTemplate, - mkImports, - classDoc, - mkClass, - objectDoc, - mkObject - ) mkString "" - - def assemble(decl: String, lines: List[String]): String = { - val body = if (lines.isEmpty) " { }\n\n" else lines map indent mkString (" {\n", "\n", "\n}\n") - - decl + body + "\n" - } - override def toString = name - } -} - -trait AnyValTemplates { - def headerTemplate = """/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. - -package scala - -""" - - def classDocTemplate = (""" -/** `@name@`@representation@ (equivalent to Java's `@javaequiv@` primitive type) is a - * subtype of [[scala.AnyVal]]. Instances of `@name@` are not - * represented by an object in the underlying runtime system. - * - * There is an implicit conversion from [[scala.@name@]] => [[scala.runtime.Rich@name@]] - * which provides useful non-primitive operations. - */ -""".trim + "\n") - - def allCompanions = """ -/** Transform a value type into a boxed reference type. - *@boxRunTimeDoc@ - * @param x the @name@ to be boxed - * @return a @boxed@ offering `x` as its underlying value. - */ -def box(x: @name@): @boxed@ = @boxImpl@ - -/** Transform a boxed type into a value type. Note that this - * method is not typesafe: it accepts any Object, but will throw - * an exception if the argument is not a @boxed@. - *@unboxRunTimeDoc@ - * @param x the @boxed@ to be unboxed. - * @throws ClassCastException if the argument is not a @boxed@ - * @return @unboxDoc@ - */ -def unbox(x: java.lang.Object): @name@ = @unboxImpl@ - -/** The String representation of the scala.@name@ companion object. */ -override def toString = "object scala.@name@" -""" - - def nonUnitCompanions = "" // todo - - def cardinalCompanion = """ -/** The smallest value representable as a @name@. */ -final val MinValue = @boxed@.MIN_VALUE - -/** The largest value representable as a @name@. */ -final val MaxValue = @boxed@.MAX_VALUE -""" - - def floatingCompanion = """ -/** The smallest positive value greater than @zero@ which is - * representable as a @name@. - */ -final val MinPositiveValue = @boxed@.MIN_VALUE -final val NaN = @boxed@.NaN -final val PositiveInfinity = @boxed@.POSITIVE_INFINITY -final val NegativeInfinity = @boxed@.NEGATIVE_INFINITY - -/** The negative number with the greatest (finite) absolute value which is representable - * by a @name@. Note that it differs from [[java.lang.@name@.MIN_VALUE]], which - * is the smallest positive value representable by a @name@. In Scala that number - * is called @name@.MinPositiveValue. - */ -final val MinValue = -@boxed@.MAX_VALUE - -/** The largest finite positive number representable as a @name@. */ -final val MaxValue = @boxed@.MAX_VALUE -""" -} - -class AnyVals extends AnyValReps with AnyValTemplates { - object B extends AnyValNum("Byte", Some("8-bit signed integer"), "byte") - object S extends AnyValNum("Short", Some("16-bit signed integer"), "short") - object C extends AnyValNum("Char", Some("16-bit unsigned integer"), "char") - object I extends AnyValNum("Int", Some("32-bit signed integer"), "int") - object L extends AnyValNum("Long", Some("64-bit signed integer"), "long") - object F extends AnyValNum("Float", Some("32-bit IEEE-754 floating point number"), "float") - object D extends AnyValNum("Double", Some("64-bit IEEE-754 floating point number"), "double") - object Z extends AnyValRep("Boolean", None, "boolean") { - def classLines = """ -/** Negates a Boolean expression. - * - * - `!a` results in `false` if and only if `a` evaluates to `true` and - * - `!a` results in `true` if and only if `a` evaluates to `false`. - * - * @return the negated expression - */ -def unary_! : Boolean - -/** Compares two Boolean expressions and returns `true` if they evaluate to the same value. - * - * `a == b` returns `true` if and only if - * - `a` and `b` are `true` or - * - `a` and `b` are `false`. - */ -def ==(x: Boolean): Boolean - -/** - * Compares two Boolean expressions and returns `true` if they evaluate to a different value. - * - * `a != b` returns `true` if and only if - * - `a` is `true` and `b` is `false` or - * - `a` is `false` and `b` is `true`. - */ -def !=(x: Boolean): Boolean - -/** Compares two Boolean expressions and returns `true` if one or both of them evaluate to true. - * - * `a || b` returns `true` if and only if - * - `a` is `true` or - * - `b` is `true` or - * - `a` and `b` are `true`. - * - * @note This method uses 'short-circuit' evaluation and - * behaves as if it was declared as `def ||(x: => Boolean): Boolean`. - * If `a` evaluates to `true`, `true` is returned without evaluating `b`. - */ -def ||(x: Boolean): Boolean - -/** Compares two Boolean expressions and returns `true` if both of them evaluate to true. - * - * `a && b` returns `true` if and only if - * - `a` and `b` are `true`. - * - * @note This method uses 'short-circuit' evaluation and - * behaves as if it was declared as `def &&(x: => Boolean): Boolean`. - * If `a` evaluates to `false`, `false` is returned without evaluating `b`. - */ -def &&(x: Boolean): Boolean - -// Compiler won't build with these seemingly more accurate signatures -// def ||(x: => Boolean): Boolean -// def &&(x: => Boolean): Boolean - -/** Compares two Boolean expressions and returns `true` if one or both of them evaluate to true. - * - * `a | b` returns `true` if and only if - * - `a` is `true` or - * - `b` is `true` or - * - `a` and `b` are `true`. - * - * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`. - */ -def |(x: Boolean): Boolean - -/** Compares two Boolean expressions and returns `true` if both of them evaluate to true. - * - * `a & b` returns `true` if and only if - * - `a` and `b` are `true`. - * - * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`. - */ -def &(x: Boolean): Boolean - -/** Compares two Boolean expressions and returns `true` if they evaluate to a different value. - * - * `a ^ b` returns `true` if and only if - * - `a` is `true` and `b` is `false` or - * - `a` is `false` and `b` is `true`. - */ -def ^(x: Boolean): Boolean - -override def getClass(): Class[Boolean] = null - """.trim.lines.toList - - def objectLines = interpolate(allCompanions + "\n" + nonUnitCompanions).lines.toList - } - object U extends AnyValRep("Unit", None, "void") { - override def classDoc = """ -/** `Unit` is a subtype of [[scala.AnyVal]]. There is only one value of type - * `Unit`, `()`, and it is not represented by any object in the underlying - * runtime system. A method with return type `Unit` is analogous to a Java - * method which is declared `void`. - */ -""" - def classLines = List( - """override def getClass(): Class[Unit] = null""" - ) - def objectLines = interpolate(allCompanions).lines.toList - - override def boxUnboxImpls = Map( - "@boxRunTimeDoc@" -> "", - "@boxImpl@" -> "scala.runtime.BoxedUnit.UNIT", - "@unboxRunTimeDoc@" -> "", - "@unboxImpl@" -> "()", - "@unboxDoc@" -> "the Unit value ()" - ) - } - - def isSubrangeType = Set(B, S, C) - def isIntegerType = Set(B, S, C, I, L) - def isFloatingType = Set(F, D) - def isWideType = Set(L, D) - - def cardinal = numeric filter isIntegerType - def numeric = List(B, S, C, I, L, F, D) - def values = List(U, Z) ++ numeric - - def make() = values map (x => (x.name, x.make())) -} diff --git a/src/compiler/scala/tools/cmd/gen/Codegen.scala b/src/compiler/scala/tools/cmd/gen/Codegen.scala deleted file mode 100644 index c3aa527ef2..0000000000 --- a/src/compiler/scala/tools/cmd/gen/Codegen.scala +++ /dev/null @@ -1,39 +0,0 @@ -/* NEST (New Scala Test) - * Copyright 2007-2013 LAMP/EPFL - * @author Paul Phillips - */ - -package scala.tools.cmd -package gen - -class Codegen(args: List[String]) extends { - val parsed = CodegenSpec(args: _*) -} with CodegenSpec with Instance - -object Codegen { - def echo(msg: String) = Console println msg - - def main(args0: Array[String]): Unit = { - val runner = new Codegen(args0.toList) - import runner._ - - if (args0.isEmpty) - return println (CodegenSpec.helpMsg) - - val out = outDir getOrElse { return println("--out is required.") } - val all = genall || !anyvals - - echo("Generating sources into " + out) - - if (anyvals || all) { - val av = new AnyVals { } - - av.make() foreach { case (name, code ) => - val file = (out / (name + ".scala")).toFile - echo("Writing: " + file) - file writeAll code - } - } - } -} - diff --git a/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala b/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala deleted file mode 100644 index 4b4a1e482d..0000000000 --- a/src/compiler/scala/tools/cmd/gen/CodegenSpec.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* NEST (New Scala Test) - * Copyright 2007-2013 LAMP/EPFL - * @author Paul Phillips - */ - -package scala.tools.cmd -package gen - -import FromString.ExistingDir - -trait CodegenSpec extends Spec with Meta.StdOpts with Interpolation { - def referenceSpec = CodegenSpec - def programInfo = Spec.Info("codegen", "", "scala.tools.cmd.gen.Codegen") - - help("Usage: codegen [<options>]") - - val outDir = "out" / "directory for generated files" --^ ExistingDir - val anyvals = "anyvals" / "generate sources for AnyVal types" --? - val genall = "all" / "generate sources for everything" --? -} - -object CodegenSpec extends CodegenSpec with Reference { - type ThisCommandLine = CommandLine - def creator(args: List[String]): ThisCommandLine = new CommandLine(CodegenSpec, args) -} diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 1a794f7554..847c4cb2d1 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -283,7 +283,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // Over 200 closure objects are eliminated by inlining this. @inline final def log(msg: => AnyRef) { if (shouldLogAtThisPhase) - inform("[log %s%s] %s".format(globalPhase, atPhaseStackMessage, msg)) + inform(s"[log $globalPhase$atPhaseStackMessage] $msg") } @inline final override def debuglog(msg: => String) { @@ -305,10 +305,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) try Some(Charset.forName(name)) catch { case _: IllegalCharsetNameException => - globalError("illegal charset name '" + name + "'") + globalError(s"illegal charset name '$name'") None case _: UnsupportedCharsetException => - globalError("unsupported charset '" + name + "'") + globalError(s"unsupported charset '$name'") None } diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index 9a53737554..00771b6b8c 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -7,7 +7,7 @@ package scala package tools.nsc package backend -import scala.collection.{ mutable, immutable } +import scala.collection.mutable /** Scala primitive operations are represented as methods in `Any` and * `AnyVal` subclasses. Here we demultiplex them by providing a mapping diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index a4d08cb123..6d3d458324 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -11,7 +11,6 @@ package jvm import scala.annotation.switch import scala.reflect.internal.Flags -import java.lang.invoke.LambdaMetafactory import scala.tools.asm import GenBCode._ @@ -803,7 +802,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { for (caze @ CaseDef(pat, guard, body) <- tree.cases) { assert(guard == EmptyTree, guard) val switchBlockPoint = new asm.Label - switchBlocks ::= (switchBlockPoint, body) + switchBlocks ::= ((switchBlockPoint, body)) pat match { case Literal(value) => flatKeys ::= value.intValue diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index 7786dbed7a..a32c21795d 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -8,7 +8,6 @@ package tools.nsc package backend.jvm import scala.tools.asm -import scala.collection.mutable import scala.tools.nsc.io.AbstractFile import GenBCode._ import BackendReporting._ @@ -877,10 +876,10 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { if(!isValidSignature) { reporter.warning(sym.pos, - """|compiler bug: created invalid generic signature for %s in %s - |signature: %s + sm"""|compiler bug: created invalid generic signature for $sym in ${sym.owner.skipPackageObject.fullName} + |signature: $sig |if this is reproducible, please report bug at https://issues.scala-lang.org/ - """.trim.stripMargin.format(sym, sym.owner.skipPackageObject.fullName, sig)) + """.trim) return null } } @@ -890,13 +889,13 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { val bytecodeTpe = owner.thisType.memberInfo(sym) if (!sym.isType && !sym.isConstructor && !(erasure.erasure(sym)(normalizedTpe) =:= bytecodeTpe)) { reporter.warning(sym.pos, - """|compiler bug: created generic signature for %s in %s that does not conform to its erasure - |signature: %s - |original type: %s - |normalized type: %s - |erasure type: %s + sm"""|compiler bug: created generic signature for $sym in ${sym.owner.skipPackageObject.fullName} that does not conform to its erasure + |signature: $sig + |original type: $memberTpe + |normalized type: $normalizedTpe + |erasure type: $bytecodeTpe |if this is reproducible, please report bug at http://issues.scala-lang.org/ - """.trim.stripMargin.format(sym, sym.owner.skipPackageObject.fullName, sig, memberTpe, normalizedTpe, bytecodeTpe)) + """.trim) return null } } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala index 1d29fdee10..84f6d87c5c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BytecodeWriters.scala @@ -6,7 +6,7 @@ package scala.tools.nsc package backend.jvm -import java.io.{ DataOutputStream, FileOutputStream, IOException, OutputStream, File => JFile } +import java.io.{ DataOutputStream, FileOutputStream, IOException, File => JFile } import scala.tools.nsc.io._ import java.util.jar.Attributes.Name import scala.language.postfixOps diff --git a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala index ab9fd94a93..4d03f9851e 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala @@ -1,7 +1,6 @@ package scala.tools.nsc package backend.jvm -import scala.annotation.switch import scala.tools.asm import scala.tools.nsc.backend.jvm.BTypes.InternalName @@ -31,7 +30,7 @@ import scala.tools.nsc.backend.jvm.BTypes.InternalName class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) { import bTypes._ import global._ - import rootMirror.{requiredClass, requiredModule, getRequiredClass, getClassIfDefined} + import rootMirror.{requiredClass, getRequiredClass, getClassIfDefined} import definitions._ /** diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala index a6b9faa933..f1facce173 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala @@ -3,13 +3,12 @@ package backend.jvm package analysis import scala.annotation.switch -import scala.tools.asm.{Handle, Type, Label} +import scala.tools.asm.{Handle, Type} import scala.tools.asm.Opcodes._ import scala.tools.asm.tree._ import scala.tools.asm.tree.analysis.{Frame, BasicInterpreter, Analyzer, Value} import GenBCode._ import scala.tools.nsc.backend.jvm.BTypes._ -import scala.tools.nsc.backend.jvm.opt.BytecodeUtils import scala.tools.nsc.backend.jvm.opt.BytecodeUtils._ import java.lang.invoke.LambdaMetafactory import scala.collection.mutable diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala index 419c686bd8..6b645cb803 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala @@ -15,7 +15,6 @@ import scala.tools.asm.{Type, MethodVisitor} import scala.tools.asm.Opcodes._ import scala.tools.asm.tree._ import scala.tools.asm.tree.analysis._ -import scala.tools.nsc.backend.jvm.BTypes.InternalName import opt.BytecodeUtils._ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala index f48f60a438..2afc095af6 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala @@ -8,6 +8,7 @@ package backend.jvm package opt import scala.annotation.{tailrec, switch} + import scala.collection.mutable import scala.reflect.internal.util.Collections._ import scala.tools.asm.commons.CodeSizeEvaluator @@ -17,7 +18,6 @@ import scala.tools.asm.Opcodes._ import scala.tools.asm.tree._ import GenBCode._ import scala.collection.convert.decorateAsScala._ -import scala.tools.nsc.backend.jvm.BTypes.InternalName import scala.tools.nsc.backend.jvm.analysis.InstructionStackEffect object BytecodeUtils { diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala index fef15bcf9a..dcfa9ef705 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala @@ -8,10 +8,10 @@ package backend.jvm package opt import scala.annotation.switch -import scala.collection.{mutable, immutable} +import scala.collection.mutable import scala.collection.immutable.IntMap import scala.reflect.internal.util.NoPosition -import scala.tools.asm.{Handle, Type, Opcodes} +import scala.tools.asm.{Type, Opcodes} import scala.tools.asm.tree._ import scala.tools.nsc.backend.jvm.BTypes.InternalName import BytecodeUtils._ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala index 35735794b1..e132ae1792 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala @@ -7,9 +7,7 @@ package scala.tools.nsc package backend.jvm package opt -import scala.collection.immutable.IntMap -import scala.tools.asm.Type -import scala.tools.asm.tree.{MethodNode, MethodInsnNode} +import scala.tools.asm.tree.MethodNode import scala.tools.nsc.backend.jvm.BTypes.InternalName import scala.collection.convert.decorateAsScala._ import scala.tools.nsc.backend.jvm.BackendReporting.OptimizerWarning diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala index 085463633f..f120357c63 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala @@ -8,11 +8,12 @@ package backend.jvm package opt import scala.annotation.{tailrec, switch} + import scala.tools.asm.Type import scala.tools.asm.tree.analysis.Frame import scala.tools.asm.Opcodes._ import scala.tools.asm.tree._ -import scala.collection.{mutable, immutable} +import scala.collection.mutable import scala.collection.convert.decorateAsScala._ import scala.tools.nsc.backend.jvm.BTypes.InternalName import scala.tools.nsc.backend.jvm.analysis._ diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index e924dc856a..7b98011759 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -9,10 +9,11 @@ package tools package nsc package settings +import scala.language.existentials + import scala.annotation.elidable import scala.tools.util.PathResolver.Defaults import scala.collection.mutable -import scala.language.{implicitConversions, existentials} trait ScalaSettings extends AbsScalaSettings with StandardScalaSettings diff --git a/src/compiler/scala/tools/nsc/settings/Warnings.scala b/src/compiler/scala/tools/nsc/settings/Warnings.scala index f570037760..79795bcc17 100644 --- a/src/compiler/scala/tools/nsc/settings/Warnings.scala +++ b/src/compiler/scala/tools/nsc/settings/Warnings.scala @@ -7,8 +7,6 @@ package scala.tools package nsc package settings -import language.existentials - /** Settings influencing the printing of warnings. */ trait Warnings { diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 1cee76ae65..9a8eca152f 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -8,7 +8,6 @@ package transform import symtab._ import Flags._ -import scala.tools.nsc.util.ClassPath abstract class AddInterfaces extends InfoTransform { self: Erasure => import global._ // the global environment diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index 76c84bd428..d350ca8e17 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -4,7 +4,6 @@ package transform import symtab._ import Flags._ import scala.collection._ -import scala.collection.mutable.LinkedHashMap /** * This transformer is responsible for preparing Function nodes for runtime, diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 0050d08f1b..4b1f1efee4 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -9,8 +9,6 @@ package transform import scala.tools.nsc.symtab.Flags import scala.collection.{ mutable, immutable } -import scala.language.postfixOps -import scala.language.existentials import scala.annotation.tailrec /** Specialize code on types. @@ -168,7 +166,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { /** Reduce the given environment to contain mappings only for type variables in tps. */ def restrict(env: TypeEnv, tps: immutable.Set[Symbol]): TypeEnv = - env filterKeys tps toMap + env.filterKeys(tps).toMap /** Is the given environment a valid specialization for sym? * It is valid if each binding is from a @specialized type parameter in sym (or its owner) @@ -367,7 +365,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } ) - lazy val specializableTypes = ScalaValueClasses map (_.tpe) sorted + lazy val specializableTypes = ScalaValueClasses.map(_.tpe).sorted /** If the symbol is the companion of a value class, the value class. * Otherwise, AnyRef. @@ -386,7 +384,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val types = if (!sym.isSpecialized) Nil // no @specialized Annotation else - specializedOn(sym) map (s => specializesClass(s).tpe) sorted + specializedOn(sym).map(s => specializesClass(s).tpe).sorted if (isBoundedGeneric(sym.tpe) && (types contains AnyRefClass)) reporter.warning(sym.pos, sym + " is always a subtype of " + AnyRefTpe + ".") @@ -474,7 +472,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case ExistentialType(_, res) => specializedTypeVars(res) case AnnotatedType(_, tp) => specializedTypeVars(tp) case TypeBounds(lo, hi) => specializedTypeVars(lo :: hi :: Nil) - case RefinedType(parents, _) => parents flatMap specializedTypeVars toSet + case RefinedType(parents, _) => parents.flatMap(specializedTypeVars).toSet case _ => immutable.Set.empty } @@ -861,7 +859,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (unusedStvars.length == 1) "is" else "are") ) unusedStvars foreach (_ removeAnnotation SpecializedClass) - specializingOn = specializingOn filterNot (unusedStvars contains) + specializingOn = specializingOn filterNot (unusedStvars contains _) } for (env0 <- specializations(specializingOn) if needsSpecialization(env0, sym)) yield { // !!! Can't this logic be structured so that the new symbol's name is @@ -1021,7 +1019,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case (NoSymbol, _) => if (overriding.isSuperAccessor) { val alias = overriding.alias - debuglog("checking special overload for super accessor: %s, alias for %s".format(overriding.fullName, alias.fullName)) + debuglog(s"checking special overload for super accessor: ${overriding.fullName}, alias for ${alias.fullName}") needsSpecialOverride(alias) match { case nope @ (NoSymbol, _) => None case (overridden, env) => @@ -1043,7 +1041,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { param.name = overriding.paramss(i)(j).name // SI-6555 Retain the parameter names from the subclass. } } - debuglog("specialized overload %s for %s in %s: %s".format(om, overriding.name.decode, pp(env), om.info)) + debuglog(s"specialized overload $om for ${overriding.name.decode} in ${pp(env)}: ${om.info}") if (overriding.isAbstractOverride) om.setFlag(ABSOVERRIDE) typeEnv(om) = env addConcreteSpecMethod(overriding) @@ -1092,7 +1090,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { */ private def unify(tp1: Type, tp2: Type, env: TypeEnv, strict: Boolean, tparams: Boolean = false): TypeEnv = (tp1, tp2) match { case (TypeRef(_, sym1, _), _) if sym1.isSpecialized => - debuglog("Unify " + tp1 + ", " + tp2) + debuglog(s"Unify $tp1, $tp2") if (isPrimitiveValueClass(tp2.typeSymbol) || isSpecializedAnyRefSubtype(tp2, sym1)) env + ((sym1, tp2)) else if (isSpecializedAnyRefSubtype(tp2, sym1)) @@ -1103,20 +1101,20 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { env case (TypeRef(_, sym1, args1), TypeRef(_, sym2, args2)) => if (args1.nonEmpty || args2.nonEmpty) - debuglog("Unify types " + tp1 + " and " + tp2) + debuglog(s"Unify types $tp1 and $tp2") if (strict && args1.length != args2.length) unifyError(tp1, tp2) val e = unify(args1, args2, env, strict) - if (e.nonEmpty) debuglog("unified to: " + e) + if (e.nonEmpty) debuglog(s"unified to: $e") e case (TypeRef(_, sym1, _), _) if sym1.isTypeParameterOrSkolem => env case (MethodType(params1, res1), MethodType(params2, res2)) => if (strict && params1.length != params2.length) unifyError(tp1, tp2) - debuglog("Unify methods " + tp1 + " and " + tp2) + debuglog(s"Unify methods $tp1 and $tp2") unify(res1 :: (params1 map (_.tpe)), res2 :: (params2 map (_.tpe)), env, strict) case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => - debuglog("Unify polytypes " + tp1 + " and " + tp2) + debuglog(s"Unify polytypes $tp1 and $tp2") if (strict && tparams1.length != tparams2.length) unifyError(tp1, tp2) else if (tparams && tparams1.length == tparams2.length) @@ -1134,7 +1132,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case (ExistentialType(_, res1), _) => unify(tp2, res1, env, strict) case (TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) => unify(List(lo1, hi1), List(lo2, hi2), env, strict) case _ => - debuglog("don't know how to unify %s [%s] with %s [%s]".format(tp1, tp1.getClass, tp2, tp2.getClass)) + debuglog(s"don't know how to unify $tp1 [${tp1.getClass}] with $tp2 [${tp2.getClass}]") env } @@ -1144,9 +1142,9 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (!strict) unify(args._1, args._2, env, strict) else { val nenv = unify(args._1, args._2, emptyEnv, strict) - if (env.keySet intersect nenv.keySet isEmpty) env ++ nenv + if (env.keySet.intersect(nenv.keySet).isEmpty) env ++ nenv else { - debuglog("could not unify: u(" + args._1 + ", " + args._2 + ") yields " + nenv + ", env: " + env) + debuglog(s"could not unify: u(${args._1}, ${args._2}) yields $nenv, env: $env") unifyError(tp1, tp2) } } @@ -1242,7 +1240,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { env forall { case (tvar, tpe) => matches(tvar.info.bounds.lo, tpe) && matches(tpe, tvar.info.bounds.hi) || { if (warnings) - reporter.warning(tvar.pos, "Bounds prevent specialization of " + tvar) + reporter.warning(tvar.pos, s"Bounds prevent specialization of $tvar") debuglog("specvars: " + tvar.info.bounds.lo + ": " + @@ -1373,7 +1371,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { sym, currentClass, sym.owner.enclClass, isAccessible(sym), nme.isLocalName(sym.name)) ) if (shouldMakePublic(sym) && !isAccessible(sym)) { - debuglog("changing private flag of " + sym) + debuglog(s"changing private flag of $sym") sym.makeNotPrivate(sym.owner) } super.transform(tree) @@ -1428,10 +1426,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { (treeType =:= memberType) || { // anyref specialization memberType match { case PolyType(_, resTpe) => - debuglog("Conformance for anyref - polytype with result type: " + resTpe + " and " + treeType + "\nOrig. sym.: " + origSymbol) + debuglog(s"Conformance for anyref - polytype with result type: $resTpe and $treeType\nOrig. sym.: $origSymbol") try { val e = unify(origSymbol.tpe, memberType, emptyEnv, true) - debuglog("obtained env: " + e) + debuglog(s"obtained env: $e") e.keySet == env.keySet } catch { case _: Throwable => @@ -1531,7 +1529,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { ) val tree1 = gen.mkTypeApply(specTree, residualTargs) - debuglog("rewrote " + tree + " to " + tree1) + debuglog(s"rewrote $tree to $tree1") localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method } @@ -1539,7 +1537,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { tree match { case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) => def transformNew = { - debuglog("Attempting to specialize new %s(%s)".format(tpt, args.mkString(", "))) + debuglog(s"Attempting to specialize new $tpt(${args.mkString(", ")})") val found = specializedType(tpt.tpe) if (found.typeSymbol ne tpt.tpe.typeSymbol) { // the ctor can be specialized val inst = New(found, transformTrees(args): _*) diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 628090dba5..e0b1543f24 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -8,7 +8,6 @@ package tools.nsc package transform import scala.annotation.tailrec -import scala.language.postfixOps import symtab.Flags._ import scala.collection.mutable diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala index 2b16995f0b..ec493b9507 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala @@ -6,8 +6,6 @@ package scala.tools.nsc.transform.patmat -import scala.language.postfixOps - import scala.collection.mutable import scala.reflect.internal.util.Statistics diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala index 27d674762f..3f27d18e64 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchWarnings.scala @@ -6,8 +6,6 @@ package scala.tools.nsc.transform.patmat -import scala.language.postfixOps - trait MatchWarnings { self: PatternMatching => diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index abc3e91ed2..c03094bc6a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -5,8 +5,6 @@ package scala.tools.nsc package typechecker -import scala.language.higherKinds - import symtab.Flags._ import scala.reflect.internal.util.StringOps.ojoin import scala.reflect.internal.util.ListOfNil diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index fdf7058ab1..8f5c4b9f6d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2882,7 +2882,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val paramsMissingType = mutable.ArrayBuffer.empty[ValDef] //.sizeHint(numVparams) probably useless, since initial size is 16 and max fun arity is 22 // first, try to define param types from expected function's arg types if needed foreach2(vparams, argpts) { (vparam, argpt) => - if (vparam.tpt isEmpty) { + if (vparam.tpt.isEmpty) { if (isFullyDefined(argpt)) vparam.tpt setType argpt else paramsMissingType += vparam diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 1c9167b2ea..9decc99c8d 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -7,14 +7,11 @@ package scala package tools package util -import scala.language.postfixOps - import java.net.URL import scala.tools.reflect.WrappedProperties.AccessControl import scala.tools.nsc.Settings import scala.tools.nsc.util.{ ClassFileLookup, ClassPath, JavaClassPath } import scala.reflect.io.{ File, Directory, Path, AbstractFile } -import scala.reflect.runtime.ReflectionUtils import ClassPath.{ JavaContext, DefaultJavaContext, split } import PartialFunction.condOpt import scala.tools.nsc.classpath.{ AggregateFlatClassPath, ClassPathFactory, FlatClassPath, FlatClassPathFactory } diff --git a/src/interactive/scala/tools/nsc/interactive/Pickler.scala b/src/interactive/scala/tools/nsc/interactive/Pickler.scala index c0446b0402..ffd3b7bc64 100644 --- a/src/interactive/scala/tools/nsc/interactive/Pickler.scala +++ b/src/interactive/scala/tools/nsc/interactive/Pickler.scala @@ -1,7 +1,5 @@ package scala.tools.nsc.interactive -import scala.language.implicitConversions - import Lexer._ import java.io.Writer diff --git a/src/library/scala/Boolean.scala b/src/library/scala/Boolean.scala index 53b4fb2af2..017f10a283 100644 --- a/src/library/scala/Boolean.scala +++ b/src/library/scala/Boolean.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -102,7 +102,8 @@ final abstract class Boolean private extends AnyVal { */ def ^(x: Boolean): Boolean - override def getClass(): Class[Boolean] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Boolean] = ??? } object Boolean extends AnyValCompanion { @@ -114,7 +115,7 @@ object Boolean extends AnyValCompanion { * @param x the Boolean to be boxed * @return a java.lang.Boolean offering `x` as its underlying value. */ - def box(x: Boolean): java.lang.Boolean = java.lang.Boolean.valueOf(x) + def box(x: Boolean): java.lang.Boolean = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -126,7 +127,7 @@ object Boolean extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Boolean * @return the Boolean resulting from calling booleanValue() on `x` */ - def unbox(x: java.lang.Object): Boolean = x.asInstanceOf[java.lang.Boolean].booleanValue() + def unbox(x: java.lang.Object): Boolean = ??? /** The String representation of the scala.Boolean companion object. */ override def toString = "object scala.Boolean" diff --git a/src/library/scala/Byte.scala b/src/library/scala/Byte.scala index fb662911b3..3709586f2e 100644 --- a/src/library/scala/Byte.scala +++ b/src/library/scala/Byte.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -434,7 +434,8 @@ final abstract class Byte private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Byte] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Byte] = ??? } object Byte extends AnyValCompanion { @@ -451,7 +452,7 @@ object Byte extends AnyValCompanion { * @param x the Byte to be boxed * @return a java.lang.Byte offering `x` as its underlying value. */ - def box(x: Byte): java.lang.Byte = java.lang.Byte.valueOf(x) + def box(x: Byte): java.lang.Byte = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -463,7 +464,7 @@ object Byte extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Byte * @return the Byte resulting from calling byteValue() on `x` */ - def unbox(x: java.lang.Object): Byte = x.asInstanceOf[java.lang.Byte].byteValue() + def unbox(x: java.lang.Object): Byte = ??? /** The String representation of the scala.Byte companion object. */ override def toString = "object scala.Byte" diff --git a/src/library/scala/Char.scala b/src/library/scala/Char.scala index 9f06503569..7dbb0209c3 100644 --- a/src/library/scala/Char.scala +++ b/src/library/scala/Char.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -434,7 +434,8 @@ final abstract class Char private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Char] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Char] = ??? } object Char extends AnyValCompanion { @@ -451,7 +452,7 @@ object Char extends AnyValCompanion { * @param x the Char to be boxed * @return a java.lang.Character offering `x` as its underlying value. */ - def box(x: Char): java.lang.Character = java.lang.Character.valueOf(x) + def box(x: Char): java.lang.Character = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -463,7 +464,7 @@ object Char extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Character * @return the Char resulting from calling charValue() on `x` */ - def unbox(x: java.lang.Object): Char = x.asInstanceOf[java.lang.Character].charValue() + def unbox(x: java.lang.Object): Char = ??? /** The String representation of the scala.Char companion object. */ override def toString = "object scala.Char" diff --git a/src/library/scala/Double.scala b/src/library/scala/Double.scala index a58fa3ed25..08bcb9fefc 100644 --- a/src/library/scala/Double.scala +++ b/src/library/scala/Double.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -200,7 +200,8 @@ final abstract class Double private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Double] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Double] = ??? } object Double extends AnyValCompanion { @@ -229,7 +230,7 @@ object Double extends AnyValCompanion { * @param x the Double to be boxed * @return a java.lang.Double offering `x` as its underlying value. */ - def box(x: Double): java.lang.Double = java.lang.Double.valueOf(x) + def box(x: Double): java.lang.Double = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -241,7 +242,7 @@ object Double extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Double * @return the Double resulting from calling doubleValue() on `x` */ - def unbox(x: java.lang.Object): Double = x.asInstanceOf[java.lang.Double].doubleValue() + def unbox(x: java.lang.Object): Double = ??? /** The String representation of the scala.Double companion object. */ override def toString = "object scala.Double" diff --git a/src/library/scala/Float.scala b/src/library/scala/Float.scala index 3c59057a8d..01fdbc00e4 100644 --- a/src/library/scala/Float.scala +++ b/src/library/scala/Float.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -200,7 +200,8 @@ final abstract class Float private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Float] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Float] = ??? } object Float extends AnyValCompanion { @@ -229,7 +230,7 @@ object Float extends AnyValCompanion { * @param x the Float to be boxed * @return a java.lang.Float offering `x` as its underlying value. */ - def box(x: Float): java.lang.Float = java.lang.Float.valueOf(x) + def box(x: Float): java.lang.Float = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -241,7 +242,7 @@ object Float extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Float * @return the Float resulting from calling floatValue() on `x` */ - def unbox(x: java.lang.Object): Float = x.asInstanceOf[java.lang.Float].floatValue() + def unbox(x: java.lang.Object): Float = ??? /** The String representation of the scala.Float companion object. */ override def toString = "object scala.Float" diff --git a/src/library/scala/Int.scala b/src/library/scala/Int.scala index 3bd3775eba..b605af5e37 100644 --- a/src/library/scala/Int.scala +++ b/src/library/scala/Int.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -434,7 +434,8 @@ final abstract class Int private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Int] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Int] = ??? } object Int extends AnyValCompanion { @@ -451,7 +452,7 @@ object Int extends AnyValCompanion { * @param x the Int to be boxed * @return a java.lang.Integer offering `x` as its underlying value. */ - def box(x: Int): java.lang.Integer = java.lang.Integer.valueOf(x) + def box(x: Int): java.lang.Integer = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -463,7 +464,7 @@ object Int extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Integer * @return the Int resulting from calling intValue() on `x` */ - def unbox(x: java.lang.Object): Int = x.asInstanceOf[java.lang.Integer].intValue() + def unbox(x: java.lang.Object): Int = ??? /** The String representation of the scala.Int companion object. */ override def toString = "object scala.Int" diff --git a/src/library/scala/Long.scala b/src/library/scala/Long.scala index b27a66647f..84e6f09da3 100644 --- a/src/library/scala/Long.scala +++ b/src/library/scala/Long.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -434,7 +434,8 @@ final abstract class Long private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Long] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Long] = ??? } object Long extends AnyValCompanion { @@ -451,7 +452,7 @@ object Long extends AnyValCompanion { * @param x the Long to be boxed * @return a java.lang.Long offering `x` as its underlying value. */ - def box(x: Long): java.lang.Long = java.lang.Long.valueOf(x) + def box(x: Long): java.lang.Long = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -463,7 +464,7 @@ object Long extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Long * @return the Long resulting from calling longValue() on `x` */ - def unbox(x: java.lang.Object): Long = x.asInstanceOf[java.lang.Long].longValue() + def unbox(x: java.lang.Object): Long = ??? /** The String representation of the scala.Long companion object. */ override def toString = "object scala.Long" diff --git a/src/library/scala/Short.scala b/src/library/scala/Short.scala index 2cbbf3cc59..136d745f16 100644 --- a/src/library/scala/Short.scala +++ b/src/library/scala/Short.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -434,7 +434,8 @@ final abstract class Short private extends AnyVal { /** Returns the remainder of the division of this value by `x`. */ def %(x: Double): Double - override def getClass(): Class[Short] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Short] = ??? } object Short extends AnyValCompanion { @@ -451,7 +452,7 @@ object Short extends AnyValCompanion { * @param x the Short to be boxed * @return a java.lang.Short offering `x` as its underlying value. */ - def box(x: Short): java.lang.Short = java.lang.Short.valueOf(x) + def box(x: Short): java.lang.Short = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -463,7 +464,7 @@ object Short extends AnyValCompanion { * @throws ClassCastException if the argument is not a java.lang.Short * @return the Short resulting from calling shortValue() on `x` */ - def unbox(x: java.lang.Object): Short = x.asInstanceOf[java.lang.Short].shortValue() + def unbox(x: java.lang.Object): Short = ??? /** The String representation of the scala.Short companion object. */ override def toString = "object scala.Short" diff --git a/src/library/scala/Unit.scala b/src/library/scala/Unit.scala index 018ad24a99..397d7b823b 100644 --- a/src/library/scala/Unit.scala +++ b/src/library/scala/Unit.scala @@ -7,8 +7,8 @@ \* */ // DO NOT EDIT, CHANGES WILL BE LOST -// This auto-generated code can be modified in scala.tools.cmd.gen. -// Afterwards, running tools/codegen-anyvals regenerates this source file. +// This auto-generated code can be modified in "project/GenerateAnyVals.scala". +// Afterwards, running "sbt generateSources" regenerates this source file. package scala @@ -19,7 +19,8 @@ package scala * method which is declared `void`. */ final abstract class Unit private extends AnyVal { - override def getClass(): Class[Unit] = null + // Provide a more specific return type for Scaladoc + override def getClass(): Class[Unit] = ??? } object Unit extends AnyValCompanion { @@ -29,7 +30,7 @@ object Unit extends AnyValCompanion { * @param x the Unit to be boxed * @return a scala.runtime.BoxedUnit offering `x` as its underlying value. */ - def box(x: Unit): scala.runtime.BoxedUnit = scala.runtime.BoxedUnit.UNIT + def box(x: Unit): scala.runtime.BoxedUnit = ??? /** Transform a boxed type into a value type. Note that this * method is not typesafe: it accepts any Object, but will throw @@ -39,7 +40,7 @@ object Unit extends AnyValCompanion { * @throws ClassCastException if the argument is not a scala.runtime.BoxedUnit * @return the Unit value () */ - def unbox(x: java.lang.Object): Unit = () + def unbox(x: java.lang.Object): Unit = ??? /** The String representation of the scala.Unit companion object. */ override def toString = "object scala.Unit" diff --git a/src/library/scala/collection/mutable/IndexedSeqView.scala b/src/library/scala/collection/mutable/IndexedSeqView.scala index 7acdeeff18..b525baaf5f 100644 --- a/src/library/scala/collection/mutable/IndexedSeqView.scala +++ b/src/library/scala/collection/mutable/IndexedSeqView.scala @@ -15,7 +15,6 @@ package mutable import generic._ import TraversableView.NoBuilder -import scala.language.implicitConversions /** A non-strict view of a mutable `IndexedSeq`. * $viewInfo diff --git a/src/library/scala/collection/mutable/ReusableBuilder.scala b/src/library/scala/collection/mutable/ReusableBuilder.scala index caab3071b6..83a4fcfc29 100644 --- a/src/library/scala/collection/mutable/ReusableBuilder.scala +++ b/src/library/scala/collection/mutable/ReusableBuilder.scala @@ -11,8 +11,6 @@ package scala package collection package mutable -import generic._ - /** `ReusableBuilder` is a marker trait that indicates that a `Builder` * can be reused to build more than one instance of a collection. In * particular, calling `result` followed by `clear` will produce a @@ -44,7 +42,7 @@ trait ReusableBuilder[-Elem, +To] extends Builder[Elem, To] { * After a call to `result`, the behavior of all other methods is undefined * save for `clear`. If `clear` is called, then the builder is reset and * may be used to build another instance. - * + * * @return a collection containing the elements added to this builder. */ override def result(): To // Note: overriding for scaladoc only! diff --git a/src/library/scala/collection/parallel/mutable/LazyCombiner.scala b/src/library/scala/collection/parallel/mutable/LazyCombiner.scala index 5ab2bb81c6..cc25b5b4b2 100644 --- a/src/library/scala/collection/parallel/mutable/LazyCombiner.scala +++ b/src/library/scala/collection/parallel/mutable/LazyCombiner.scala @@ -30,7 +30,6 @@ 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/library/scala/collection/parallel/mutable/ParTrieMap.scala b/src/library/scala/collection/parallel/mutable/ParTrieMap.scala index a1dc37cec9..2faf223b99 100644 --- a/src/library/scala/collection/parallel/mutable/ParTrieMap.scala +++ b/src/library/scala/collection/parallel/mutable/ParTrieMap.scala @@ -152,18 +152,9 @@ extends TrieMapIterator[K, V](lev, ct, mustInit) /** Only used within the `ParTrieMap`. */ private[mutable] trait ParTrieMapCombiner[K, V] extends Combiner[(K, V), ParTrieMap[K, V]] { - def combine[N <: (K, V), NewTo >: ParTrieMap[K, V]](other: Combiner[N, NewTo]): Combiner[N, NewTo] = if (this eq other) this else { - throw new UnsupportedOperationException("This shouldn't have been called in the first place.") - - val thiz = this.asInstanceOf[ParTrieMap[K, V]] - val that = other.asInstanceOf[ParTrieMap[K, V]] - val result = new ParTrieMap[K, V] - - result ++= thiz.iterator - result ++= that.iterator - - result - } + def combine[N <: (K, V), NewTo >: ParTrieMap[K, V]](other: Combiner[N, NewTo]): Combiner[N, NewTo] = + if (this eq other) this + else throw new UnsupportedOperationException("This shouldn't have been called in the first place.") override def canBeShared = true } diff --git a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala index d53b56d484..e71e61f2f1 100644 --- a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala +++ b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala @@ -14,8 +14,6 @@ import scala.collection.mutable.DoublingUnrolledBuffer import scala.collection.mutable.UnrolledBuffer.Unrolled import scala.collection.parallel.Combiner import scala.collection.parallel.Task -import scala.reflect.ClassTag - /** An array combiner that uses doubling unrolled buffers to store elements. */ trait UnrolledParArrayCombiner[T] diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala index a905ef345c..f69030bd3d 100644 --- a/src/library/scala/concurrent/duration/Duration.scala +++ b/src/library/scala/concurrent/duration/Duration.scala @@ -9,8 +9,6 @@ package scala.concurrent.duration import java.lang.{ Double => JDouble, Long => JLong } -import scala.language.implicitConversions -import scala.language.postfixOps object Duration { @@ -57,7 +55,7 @@ object Duration { case "Inf" | "PlusInf" | "+Inf" => Inf case "MinusInf" | "-Inf" => MinusInf case _ => - val unitName = s1.reverse takeWhile (_.isLetter) reverse; + val unitName = s1.reverse.takeWhile(_.isLetter).reverse; timeUnit get unitName match { case Some(unit) => val valueStr = s1 dropRight unitName.length @@ -87,11 +85,11 @@ object Duration { // TimeUnit => standard label protected[duration] val timeUnitName: Map[TimeUnit, String] = - timeUnitLabels.toMap mapValues (s => words(s).last) toMap + timeUnitLabels.toMap.mapValues(s => words(s).last).toMap // Label => TimeUnit protected[duration] val timeUnit: Map[String, TimeUnit] = - timeUnitLabels flatMap { case (unit, names) => expandLabels(names) map (_ -> unit) } toMap + timeUnitLabels.flatMap{ case (unit, names) => expandLabels(names) map (_ -> unit) }.toMap /** * Extract length and time unit out of a string, where the format must match the description for [[Duration$.apply(s:String)* apply(String)]]. diff --git a/src/library/scala/math/Integral.scala b/src/library/scala/math/Integral.scala index ff1f695f6d..44009fd4a2 100644 --- a/src/library/scala/math/Integral.scala +++ b/src/library/scala/math/Integral.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala package math diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala index 675b3c8c61..01da0c1ef2 100644 --- a/src/library/scala/util/Either.scala +++ b/src/library/scala/util/Either.scala @@ -11,8 +11,6 @@ package scala package util -import scala.language.implicitConversions - /** Represents a value of one of two possible types (a disjoint union.) * Instances of Either are either an instance of [[scala.util.Left]] or [[scala.util.Right]]. * diff --git a/src/library/scala/util/Try.scala b/src/library/scala/util/Try.scala index 84d170249d..3c8b21b03c 100644 --- a/src/library/scala/util/Try.scala +++ b/src/library/scala/util/Try.scala @@ -10,7 +10,6 @@ package scala package util import scala.util.control.NonFatal -import scala.language.implicitConversions /** * The `Try` type represents a computation that may either result in an exception, or return a diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index 8074b448fe..d2312440cc 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -840,7 +840,7 @@ trait Definitions extends api.StandardDefinitions { def samOf(tp: Type): Symbol = if (!doSam) NoSymbol else { // look at erased type because we (only) care about what ends up in bytecode // (e.g., an alias type or intersection type is fine as long as the intersection dominator compiles to an interface) - val tpSym = erasure.javaErasure(tp).typeSymbol + val tpSym: Symbol = erasure.javaErasure(tp).typeSymbol if (tpSym.exists && tpSym.isClass // if tp has a constructor (its class is not a trait), it must be public and must not take any arguments diff --git a/src/reflect/scala/reflect/internal/Internals.scala b/src/reflect/scala/reflect/internal/Internals.scala index cfacad24b4..1a48701ca7 100644 --- a/src/reflect/scala/reflect/internal/Internals.scala +++ b/src/reflect/scala/reflect/internal/Internals.scala @@ -3,7 +3,6 @@ package reflect package internal import scala.language.implicitConversions -import scala.language.higherKinds import scala.reflect.api.Universe import scala.reflect.macros.Attachments diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala index c58cb71e97..30f2efd7e3 100644 --- a/src/reflect/scala/reflect/internal/ReificationSupport.scala +++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala @@ -287,6 +287,8 @@ trait ReificationSupport { self: SymbolTable => val evdefs = gvdefs.zip(lvdefs).map { case (gvdef @ ValDef(_, _, tpt: TypeTree, _), ValDef(_, _, _, rhs)) => copyValDef(gvdef)(tpt = tpt.original, rhs = rhs) + case (tr1, tr2) => + throw new MatchError((tr1, tr2)) } val edefs = evdefs ::: etdefs if (ctorMods.isTrait) diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 054cbafc3c..de82a6a0b2 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -3932,6 +3932,8 @@ trait Types et.withTypeVars(isConsistent(_, tp2)) case (_, et: ExistentialType) => et.withTypeVars(isConsistent(tp1, _)) + case (_, _) => + throw new MatchError((tp1, tp2)) } def check(tp1: Type, tp2: Type) = ( diff --git a/src/reflect/scala/reflect/internal/transform/Transforms.scala b/src/reflect/scala/reflect/internal/transform/Transforms.scala index 296ccde443..0d2f355aa5 100644 --- a/src/reflect/scala/reflect/internal/transform/Transforms.scala +++ b/src/reflect/scala/reflect/internal/transform/Transforms.scala @@ -23,9 +23,9 @@ trait Transforms { self: SymbolTable => } } - private val refChecksLazy = new Lazy(new { val global: Transforms.this.type = self } with RefChecks) - private val uncurryLazy = new Lazy(new { val global: Transforms.this.type = self } with UnCurry) - private val erasureLazy = new Lazy(new { val global: Transforms.this.type = self } with Erasure) + private val refChecksLazy = new Lazy(new { val global: Transforms.this.type = self } with RefChecks) + private val uncurryLazy = new Lazy(new { val global: Transforms.this.type = self } with UnCurry) + private val erasureLazy = new Lazy(new { val global: Transforms.this.type = self } with Erasure) private val postErasureLazy = new Lazy(new { val global: Transforms.this.type = self } with PostErasure) def refChecks = refChecksLazy.force diff --git a/src/reflect/scala/reflect/macros/Enclosures.scala b/src/reflect/scala/reflect/macros/Enclosures.scala index 1eb6832b5b..798fed2a15 100644 --- a/src/reflect/scala/reflect/macros/Enclosures.scala +++ b/src/reflect/scala/reflect/macros/Enclosures.scala @@ -2,8 +2,6 @@ package scala package reflect package macros -import scala.language.existentials // SI-6541 - /** * <span class="badge badge-red" style="float: right;">EXPERIMENTAL</span> * diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala index 9d61cd2e2b..88b84be65e 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlFactory.scala @@ -17,7 +17,7 @@ import page.diagram._ * @author David Bernard * @author Gilles Dubochet */ class HtmlFactory(val universe: doc.Universe, val reporter: ScalaDocReporter) { - import page.{IndexScript, EntityPage} + import page.IndexScript /** The character encoding to be used for generated Scaladoc sites. * This value is currently always UTF-8. */ @@ -33,6 +33,7 @@ class HtmlFactory(val universe: doc.Universe, val reporter: ScalaDocReporter) { "class_comp.svg", "object_comp.svg", "trait_comp.svg", + "object_comp_trait.svg", "abstract_type.svg", "lato-v11-latin-100.eot", "lato-v11-latin-100.ttf", diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala index 038d85b7a8..0f37f86b3e 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala @@ -216,34 +216,6 @@ abstract class HtmlPage extends Page { thisPage => val Trait, Class, Type, Object, Package = Value } - /** Returns the _big image name and the alt attribute - * corresponding to the DocTemplate Entity (upper left icon) */ - def docEntityKindToBigImage(ety: DocTemplateEntity) = { - def entityToImage(e: DocTemplateEntity) = - if (e.isTrait) Image.Trait - else if (e.isClass) Image.Class - else if (e.isAbstractType || e.isAliasType) Image.Type - else if (e.isObject) Image.Object - else if (e.isPackage) Image.Package - else { - // FIXME: an entity *should* fall into one of the above categories, - // but AnyRef is somehow not - Image.Class - } - - val image = entityToImage(ety) - val companionImage = ety.companion filter { - e => e.visibility.isPublic && ! e.inSource.isEmpty - } map { entityToImage } - - (image, companionImage) match { - case (from, Some(to)) => - ((from + "_to_" + to + "_big.png").toLowerCase, from + "/" + to) - case (from, None) => - ((from + "_big.png").toLowerCase, from.toString) - } - } - def permalink(template: Entity, isSelf: Boolean = true): Elem = <span class="permalink"> <a href={ memberToUrl(template, isSelf) } title="Permalink"> @@ -251,6 +223,9 @@ abstract class HtmlPage extends Page { thisPage => </a> </span> + def docEntityImageClass(tpl: DocTemplateEntity): String = + tpl.kind + tpl.companion.fold("")("-companion-" + _.kind) + def docEntityKindToCompanionTitle(ety: DocTemplateEntity, baseString: String = "See companion") = ety.companion match{ case Some(companion) => diff --git a/src/scaladoc/scala/tools/nsc/doc/html/Page.scala b/src/scaladoc/scala/tools/nsc/doc/html/Page.scala index 875d7919c2..c720c4939f 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/Page.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/Page.scala @@ -102,6 +102,11 @@ abstract class Page { relativize(thisPage.path.reverse, destPath.reverse).mkString("/") } + def hasCompanion(mbr: TemplateEntity): Boolean = mbr match { + case dtpl: DocTemplateEntity => dtpl.companion.isDefined + case _ => false + } + protected def inlineToStr(inl: comment.Inline): String = inl match { case comment.Chain(items) => items flatMap (inlineToStr(_)) mkString "" case comment.Italic(in) => inlineToStr(in) diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala index e45847da78..836d1b4b7d 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala @@ -79,21 +79,24 @@ trait EntityPage extends HtmlPage { <ul> { def entityToUl(mbr: TemplateEntity with MemberEntity, indentation: Int): NodeSeq = - <li class={"current-entities indented" + indentation}> - { - mbr match { - case dtpl: DocTemplateEntity => - dtpl.companion.fold(<span class="separator"></span>) { c: DocTemplateEntity => - <a class="object" href={relativeLinkTo(c)} title={c.comment.fold("")(com => inlineToStr(com.short))}></a> - } - case _ => <span class="separator"></span> + if (mbr.isObject && hasCompanion(mbr)) + NodeSeq.Empty + else + <li class={"current-entities indented" + indentation}> + { + mbr match { + case dtpl: DocTemplateEntity => + dtpl.companion.fold(<span class="separator"></span>) { c: DocTemplateEntity => + <a class="object" href={relativeLinkTo(c)} title={c.comment.fold("")(com => inlineToStr(com.short))}></a> + } + case _ => <span class="separator"></span> + } } - } - <a class={mbr.kind} href={relativeLinkTo(mbr)} title={mbr.comment.fold("")(com => inlineToStr(com.short))}></a> - <a href={relativeLinkTo(mbr)} title={mbr.comment.fold("")(com => inlineToStr(com.short))}> - {mbr.name} - </a> - </li> + <a class={mbr.kind} href={relativeLinkTo(mbr)} title={mbr.comment.fold("")(com => inlineToStr(com.short))}></a> + <a href={relativeLinkTo(mbr)} title={mbr.comment.fold("")(com => inlineToStr(com.short))}> + {mbr.name} + </a> + </li> // Get path from root val rootToParentLis = tpl.toRoot @@ -123,7 +126,7 @@ trait EntityPage extends HtmlPage { val subsToTplLis = subsToTpl.map(memberToHtml(_, tpl, indentation = rootToParentLis.length)) val subsAfterTplLis = subsAfterTpl.map(memberToHtml(_, tpl, indentation = rootToParentLis.length)) val currEntityLis = currentPackageTpls - .filter(x => !x.isPackage && (x.isTrait || x.isClass || x.isAbstractType)) + .filter(x => !x.isPackage && (x.isTrait || x.isClass || x.isAbstractType || x.isObject)) .sortBy(_.name) .map(entityToUl(_, (if (tpl.isPackage) 0 else -1) + rootToParentLis.length)) val currSubLis = tpl.templates @@ -213,14 +216,13 @@ trait EntityPage extends HtmlPage { <body class={ tpl.kind + (if (tpl.isType) " type" else " value") }> <div id="definition"> { - val (src, alt) = docEntityKindToBigImage(tpl) - val identifier = alt.toString.substring(0,2).toLowerCase + val imageClass = docEntityImageClass(tpl) tpl.companion match { case Some(companion) if (companion.visibility.isPublic && companion.inSource != None) => - <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}><div class={s"big-circle companion $identifier"}>{ identifier.substring(0,1) }</div></a> + <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}><div class={s"big-circle $imageClass"}>{ imageClass.substring(0,1) }</div></a> case _ => - <div class={ "big-circle " + alt.toString.toLowerCase }>{ identifier.substring(0,1) }</div> + <div class={s"big-circle $imageClass"}>{ imageClass.substring(0,1) }</div> } } { owner } diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js index 5d72b9bf71..1a2e62b314 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js @@ -506,7 +506,7 @@ function listItem(entity, regExp) { } else { var spacer = document.createElement("div"); spacer.className = "icon spacer"; - li.appendChild(spacer); + li.insertBefore(spacer, iconElem); } var ul = document.createElement("ul"); diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/object_comp_trait.svg b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/object_comp_trait.svg new file mode 100644 index 0000000000..56eccd03ba --- /dev/null +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/object_comp_trait.svg @@ -0,0 +1,57 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="72px" height="72px" viewBox="0 0 72 72" version="1.1"> + <defs> + <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1"> + <feOffset dx="0" dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/> + <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/> + <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"/> + <feMerge> + <feMergeNode in="shadowMatrixOuter1"/> + <feMergeNode in="SourceGraphic"/> + </feMerge> + </filter> + <circle id="path-2" cx="32" cy="32" r="32"/> + <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-4"> + <feOffset dx="0" dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/> + <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/> + <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"/> + <feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetInner1"/> + <feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"/> + <feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"/> + <feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.14 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"/> + <feOffset dx="0" dy="-1" in="SourceAlpha" result="shadowOffsetInner2"/> + <feGaussianBlur stdDeviation="0" in="shadowOffsetInner2" result="shadowBlurInner2"/> + <feComposite in="shadowBlurInner2" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner2"/> + <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0" in="shadowInnerInner2" type="matrix" result="shadowMatrixInner2"/> + <feMerge> + <feMergeNode in="shadowMatrixOuter1"/> + <feMergeNode in="SourceGraphic"/> + <feMergeNode in="shadowMatrixInner1"/> + <feMergeNode in="shadowMatrixInner2"/> + </feMerge> + </filter> + <path id="path-5" d="M32 61C49.673112 61 64 48.0162577 64 32 64 15.9837423 49.673112 3 32 3 14.326888 3 0 15.9837423 0 32 0 48.0162577 14.326888 61 32 61Z"/> + </defs> + <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <g id="Artboard-1" transform="translate(-298.000000, -91.000000)"> + <g id="BG" transform="translate(302.000000, 91.000000)"> + <g id="Icon"> + <mask id="mask-3" fill="white"> + <use xlink:href="#path-2"/> + </mask> + <use id="Mask" fill="#19AACF" filter="url(#filter-1)" xlink:href="#path-2"/> + <rect id="Rectangle-2" opacity="0.3" fill="#000000" mask="url(#mask-3)" x="-8" y="33" width="80" height="31"/> + <mask id="mask-6" fill="white"> + <use xlink:href="#path-5"/> + </mask> + <use id="Mask" fill="#2C6C8D" filter="url(#filter-4)" xlink:href="#path-5"/> + <text id="t" mask="url(#mask-6)" font-family="Open Sans, Helvetica Neueu, Sans-serif" font-size="40" font-weight="normal" fill="#FFFFFF"> + <tspan x="17" y="47"> + O + </tspan> + </text> + <rect id="Rectangle-2" opacity="0.190065299" fill="#000000" mask="url(#mask-6)" x="-8" y="2" width="80" height="31"/> + </g> + </g> + </g> + </g> +</svg> diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css index def2da65e7..f222749dd2 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css @@ -216,18 +216,22 @@ span.symbol > a { background: url("class.svg") no-repeat center; } -.big-circle.cl.companion { +.big-circle.class-companion-object { background: url("class_comp.svg") no-repeat center; } -.big-circle.ob.companion { +.big-circle.object-companion-class { background: url("object_comp.svg") no-repeat center; } -.big-circle.tr.companion { +.big-circle.trait-companion-object { background: url("trait_comp.svg") no-repeat center; } +.big-circle.object-companion-trait { + background: url("object_comp_trait.svg") no-repeat center; +} + .big-circle.object { background: url("object.svg") no-repeat center; } diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js index e6fc01325a..64177a7723 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js @@ -275,10 +275,15 @@ $(document).ready(function() { } }; - $(".toggleContainer:not(.diagram-container)").click(function() { + $(".toggleContainer:not(.diagram-container):not(.full-signature-block)").click(function() { toggleShowContentFct($(this)); }); + $(".toggleContainer.full-signature-block").click(function() { + toggleShowContentFct($(this)); + return false; + }); + if ($("#order > ol > li.group").length == 1) { orderGroup(); }; function findElementByHash(locationHash) { diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala index 3bfb82a639..064c7ac34c 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala @@ -11,8 +11,6 @@ package scalax package rules package scalasig -import language.postfixOps - import java.io.{PrintStream, ByteArrayOutputStream} import java.util.regex.Pattern import scala.tools.scalap.scalax.util.StringUtil |