Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Maintenance of Predef.

1) Deprecates much of Predef and scala.Console, especially:

 - the read* methods (see below)
 - the set{Out,Err,In} methods (see SI-4793)

2) Removed long-deprecated:

 - Predef#exit
 - Predef#error should have gone, but could not due to sbt

At least the whole source base has now been future-proofed
against the eventual removal of Predef#error.

The low justification for the read* methods should be readily
apparent: they are little used and have no call to be in global
namespace, especially given their weird ad hoc semantics and
unreasonably tempting names such as readBoolean().

3) Segregated the deprecated elements in Predef from the part
which still thrives.

4) Converted all the standard Predef implicits into implicit
classes, value classes where possible:

  - ArrowAssoc, Ensuring, StringFormat, StringAdd, RichException (value)
  - SeqCharSequence, ArrayCharSequence (non-value)

Non-implicit deprecated stubs prop up the names of the
formerly converting methods.
  • Loading branch information...
commit c26a8db067e4f04ef959bb9a8402fa3e931c3cd7 1 parent 0c59fc9
@paulp paulp authored
Showing with 752 additions and 665 deletions.
  1. +4 −4 src/compiler/scala/tools/nsc/doc/Settings.scala
  2. +2 −2 src/compiler/scala/tools/nsc/interactive/REPL.scala
  3. +49 −295 src/library/scala/Console.scala
  4. +1 −1  src/library/scala/LowPriorityImplicits.scala
  5. +87 −63 src/library/scala/Predef.scala
  6. +53 −0 src/library/scala/io/AnsiColor.scala
  7. +228 −0 src/library/scala/io/ReadStdin.scala
  8. +1 −0  src/library/scala/runtime/RichException.scala
  9. +3 −0  src/library/scala/runtime/SeqCharSequence.scala
  10. +1 −0  src/library/scala/runtime/StringAdd.scala
  11. +1 −0  src/library/scala/runtime/StringFormat.scala
  12. +2 −0  test/files/instrumented/InstrumentationTest.check
  13. +5 −5 test/files/neg/classmanifests_new_deprecations.check
  14. +2 −2 test/files/neg/logImplicits.check
  15. +1 −1  test/files/neg/predef-masking.scala
  16. +2 −2 test/files/neg/t1010.scala
  17. +1 −1  test/files/neg/t414.scala
  18. +1 −1  test/files/neg/t421.check
  19. +1 −1  test/files/neg/t421.scala
  20. +2 −2 test/files/neg/t4271.scala
  21. +3 −3 test/files/pos/List1.scala
  22. +3 −3 test/files/pos/depmet_implicit_chaining_zw.scala
  23. +10 −10 test/files/pos/depmet_implicit_norm_ret.scala
  24. +4 −4 test/files/pos/implicits-new.scala
  25. +20 −20 test/files/pos/implicits-old.scala
  26. +3 −3 test/files/pos/relax_implicit_divergence.scala
  27. +1 −1  test/files/pos/simple-exceptions.scala
  28. +3 −3 test/files/pos/spec-asseenfrom.scala
  29. +5 −5 test/files/pos/spec-cyclic.scala
  30. +4 −4 test/files/pos/spec-sealed.scala
  31. +8 −8 test/files/pos/spec-sparsearray-new.scala
  32. +7 −7 test/files/pos/spec-sparsearray-old.scala
  33. +6 −6 test/files/pos/spec-traits.scala
  34. +3 −3 test/files/pos/t0031.scala
  35. +2 −2 test/files/pos/t0227.scala
  36. +2 −2 test/files/pos/t2331.scala
  37. +7 −7 test/files/pos/t2421.scala
  38. +5 −5 test/files/pos/t2429.scala
  39. +2 −2 test/files/pos/t2797.scala
  40. +5 −5 test/files/pos/t3152.scala
  41. +3 −3 test/files/pos/t3252.scala
  42. +2 −2 test/files/pos/t3349/Test.scala
  43. +2 −2 test/files/pos/t3363-new.scala
  44. +1 −1  test/files/pos/t3363-old.scala
  45. +5 −5 test/files/pos/t3440.scala
  46. +2 −2 test/files/pos/t3477.scala
  47. +2 −2 test/files/pos/t3731.scala
  48. +4 −4 test/files/pos/t3883.scala
  49. +2 −2 test/files/pos/t3927.scala
  50. +9 −9 test/files/pos/tcpoly_boundedmonad.scala
  51. +4 −4 test/files/pos/tcpoly_infer_explicit_tuple_wrapper.scala
  52. +2 −2 test/files/pos/tcpoly_infer_implicit_tuple_wrapper.scala
  53. +9 −9 test/files/pos/tcpoly_overloaded.scala
  54. +1 −1  test/files/pos/tcpoly_subst.scala
  55. +2 −2 test/files/pos/tcpoly_variance_pos.scala
  56. +1 −1  test/files/pos/tcpoly_wildcards.scala
  57. +7 −7 test/files/pos/typealias_dubious.scala
  58. +2 −2 test/files/pos/virtpatmat_binding_opt.scala
  59. +2 −1  test/files/presentation/callcc-interpreter.check
  60. +2 −1  test/files/presentation/ide-bug-1000349.check
  61. +6 −3 test/files/presentation/ide-bug-1000475.check
  62. +2 −1  test/files/presentation/ide-bug-1000531.check
  63. +2 −1  test/files/presentation/implicit-member.check
  64. +4 −2 test/files/presentation/ping-pong.check
  65. +2 −1  test/files/presentation/t5708.check
  66. +10 −5 test/files/presentation/visibility.check
  67. +12 −12 test/files/run/Course-2002-07.scala
  68. +2 −2 test/files/run/Course-2002-08.scala
  69. +6 −6 test/files/run/Course-2002-09.scala
  70. +2 −2 test/files/run/Course-2002-13.scala
  71. +8 −5 test/files/run/analyzerPlugins.check
  72. +1 −0  test/files/run/array-charSeq.scala
  73. +1 −1  test/files/run/arrays.scala
  74. +25 −25 test/files/run/exceptions-2.scala
  75. +2 −2 test/files/run/exceptions.scala
  76. +4 −4 test/files/run/exoticnames.scala
  77. +6 −5 test/files/run/genericValueClass.scala
  78. +1 −1  test/files/run/macro-typecheck-implicitsdisabled.check
  79. +1 −1  test/files/run/runtime.scala
  80. +1 −1  test/files/run/t1042.scala
  81. +9 −9 test/files/run/tailcalls.scala
  82. +1 −1  test/files/run/toolbox_typecheck_implicitsdisabled.check
  83. +8 −8 test/files/run/try-2.scala
  84. +5 −5 test/files/run/try.scala
  85. +1 −1  test/files/run/verify-ctor.scala
  86. +14 −14 test/files/scalacheck/CheckEither.scala
  87. +2 −2 test/scaladoc/resources/SI_4715.scala
View
8 src/compiler/scala/tools/nsc/doc/Settings.scala
@@ -315,10 +315,10 @@ class Settings(error: String => Unit, val printMsg: String => Unit = println(_))
/** Common conversion targets that affect any class in Scala */
val commonConversionTargets = Set(
- "scala.Predef.any2stringfmt",
- "scala.Predef.any2stringadd",
- "scala.Predef.any2ArrowAssoc",
- "scala.Predef.any2Ensuring",
+ "scala.Predef.StringFormat",
+ "scala.Predef.StringAdd",
+ "scala.Predef.ArrowAssoc",
+ "scala.Predef.Ensuring",
"scala.collection.TraversableOnce.alternateImplicit")
/** There's a reason all these are specialized by hand but documenting each of them is beyond the point */
View
4 src/compiler/scala/tools/nsc/interactive/REPL.scala
@@ -59,7 +59,7 @@ object REPL {
def main(args: Array[String]) {
process(args)
- /*sys.*/exit(if (reporter.hasErrors) 1 else 0)// Don't use sys yet as this has to run on 2.8.2 also.
+ sys.exit(if (reporter.hasErrors) 1 else 0)
}
def loop(action: (String) => Unit) {
@@ -182,7 +182,7 @@ object REPL {
println(instrument(arguments, line.toInt))
case List("quit") =>
comp.askShutdown()
- exit(1) // Don't use sys yet as this has to run on 2.8.2 also.
+ sys.exit(1)
case List("structure", file) =>
doStructure(file)
case _ =>
View
344 src/library/scala/Console.scala
@@ -6,16 +6,12 @@
** |/ **
\* */
-
-
package scala
-import java.io.{BufferedReader, InputStream, InputStreamReader,
- IOException, OutputStream, PrintStream, Reader}
-import java.text.MessageFormat
+import java.io.{ BufferedReader, InputStream, InputStreamReader, OutputStream, PrintStream, Reader }
+import scala.io.{ AnsiColor, ReadStdin }
import scala.util.DynamicVariable
-
/** Implements functionality for
* printing Scala values on the terminal as well as reading specific values.
* Also defines constants for marking up text on ANSI terminals.
@@ -23,60 +19,16 @@ import scala.util.DynamicVariable
* @author Matthias Zenger
* @version 1.0, 03/09/2003
*/
-object Console {
-
- /** Foreground color for ANSI black */
- final val BLACK = "\033[30m"
- /** Foreground color for ANSI red */
- final val RED = "\033[31m"
- /** Foreground color for ANSI green */
- final val GREEN = "\033[32m"
- /** Foreground color for ANSI yellow */
- final val YELLOW = "\033[33m"
- /** Foreground color for ANSI blue */
- final val BLUE = "\033[34m"
- /** Foreground color for ANSI magenta */
- final val MAGENTA = "\033[35m"
- /** Foreground color for ANSI cyan */
- final val CYAN = "\033[36m"
- /** Foreground color for ANSI white */
- final val WHITE = "\033[37m"
-
- /** Background color for ANSI black */
- final val BLACK_B = "\033[40m"
- /** Background color for ANSI red */
- final val RED_B = "\033[41m"
- /** Background color for ANSI green */
- final val GREEN_B = "\033[42m"
- /** Background color for ANSI yellow */
- final val YELLOW_B = "\033[43m"
- /** Background color for ANSI blue */
- final val BLUE_B = "\033[44m"
- /** Background color for ANSI magenta */
- final val MAGENTA_B = "\033[45m"
- /** Background color for ANSI cyan */
- final val CYAN_B = "\033[46m"
- /** Background color for ANSI white */
- final val WHITE_B = "\033[47m"
-
- /** Reset ANSI styles */
- final val RESET = "\033[0m"
- /** ANSI bold */
- final val BOLD = "\033[1m"
- /** ANSI underlines */
- final val UNDERLINED = "\033[4m"
- /** ANSI blink */
- final val BLINK = "\033[5m"
- /** ANSI reversed */
- final val REVERSED = "\033[7m"
- /** ANSI invisible */
- final val INVISIBLE = "\033[8m"
-
+object Console extends DeprecatedConsole with AnsiColor {
private val outVar = new DynamicVariable[PrintStream](java.lang.System.out)
private val errVar = new DynamicVariable[PrintStream](java.lang.System.err)
- private val inVar = new DynamicVariable[BufferedReader](
+ private val inVar = new DynamicVariable[BufferedReader](
new BufferedReader(new InputStreamReader(java.lang.System.in)))
+ protected def setOutDirect(out: PrintStream): Unit = outVar.value = out
+ protected def setErrDirect(err: PrintStream): Unit = errVar.value = err
+ protected def setInDirect(in: BufferedReader): Unit = inVar.value = in
+
/** The default output, can be overridden by `setOut` */
def out = outVar.value
/** The default error, can be overridden by `setErr` */
@@ -84,12 +36,6 @@ object Console {
/** The default input, can be overridden by `setIn` */
def in = inVar.value
- /** Sets the default output stream.
- *
- * @param out the new output stream.
- */
- def setOut(out: PrintStream) { outVar.value = out }
-
/** Sets the default output stream for the duration
* of execution of one thunk.
*
@@ -106,13 +52,6 @@ object Console {
def withOut[T](out: PrintStream)(thunk: =>T): T =
outVar.withValue(out)(thunk)
- /** Sets the default output stream.
- *
- * @param out the new output stream.
- */
- def setOut(out: OutputStream): Unit =
- setOut(new PrintStream(out))
-
/** Sets the default output stream for the duration
* of execution of one thunk.
*
@@ -125,13 +64,6 @@ object Console {
def withOut[T](out: OutputStream)(thunk: =>T): T =
withOut(new PrintStream(out))(thunk)
-
- /** Sets the default error stream.
- *
- * @param err the new error stream.
- */
- def setErr(err: PrintStream) { errVar.value = err }
-
/** Set the default error stream for the duration
* of execution of one thunk.
* @example {{{
@@ -147,13 +79,6 @@ object Console {
def withErr[T](err: PrintStream)(thunk: =>T): T =
errVar.withValue(err)(thunk)
- /** Sets the default error stream.
- *
- * @param err the new error stream.
- */
- def setErr(err: OutputStream): Unit =
- setErr(new PrintStream(err))
-
/** Sets the default error stream for the duration
* of execution of one thunk.
*
@@ -166,15 +91,6 @@ object Console {
def withErr[T](err: OutputStream)(thunk: =>T): T =
withErr(new PrintStream(err))(thunk)
-
- /** Sets the default input stream.
- *
- * @param reader specifies the new input stream.
- */
- def setIn(reader: Reader) {
- inVar.value = new BufferedReader(reader)
- }
-
/** Sets the default input stream for the duration
* of execution of one thunk.
*
@@ -195,14 +111,6 @@ object Console {
def withIn[T](reader: Reader)(thunk: =>T): T =
inVar.withValue(new BufferedReader(reader))(thunk)
- /** Sets the default input stream.
- *
- * @param in the new input stream.
- */
- def setIn(in: InputStream) {
- setIn(new InputStreamReader(in))
- }
-
/** Sets the default input stream for the duration
* of execution of one thunk.
*
@@ -251,218 +159,64 @@ object Console {
* @throws java.lang.IllegalArgumentException if there was a problem with the format string or arguments
*/
def printf(text: String, args: Any*) { out.print(text format (args : _*)) }
+}
- /** Read a full line from the default input. Returns `null` if the end of the
- * input stream has been reached.
- *
- * @return the string read from the terminal or null if the end of stream was reached.
- */
- def readLine(): String = in.readLine()
-
- /** Print formatted text to the default output and read a full line from the default input.
- * Returns `null` if the end of the input stream has been reached.
- *
- * @param text the format of the text to print out, as in `printf`.
- * @param args the parameters used to instantiate the format, as in `printf`.
- * @return the string read from the default input
- */
- def readLine(text: String, args: Any*): String = {
- printf(text, args: _*)
- readLine()
- }
-
- /** Reads a boolean value from an entire line of the default input.
- * Has a fairly liberal interpretation of the input.
- *
- * @return the boolean value read, or false if it couldn't be converted to a boolean
- * @throws java.io.EOFException if the end of the input stream has been reached.
- */
- def readBoolean(): Boolean = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toLowerCase() match {
- case "true" => true
- case "t" => true
- case "yes" => true
- case "y" => true
- case _ => false
- }
- }
-
- /** Reads a byte value from an entire line of the default input.
- *
- * @return the Byte that was read
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to a Byte
- */
- def readByte(): Byte = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toByte
- }
-
- /** Reads a short value from an entire line of the default input.
- *
- * @return the short that was read
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to a Short
- */
- def readShort(): Short = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toShort
- }
-
- /** Reads a char value from an entire line of the default input.
- *
- * @return the Char that was read
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.StringIndexOutOfBoundsException if the line read from default input was empty
- */
- def readChar(): Char = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s charAt 0
- }
-
- /** Reads an int value from an entire line of the default input.
- *
- * @return the Int that was read
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to an Int
- */
- def readInt(): Int = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toInt
- }
-
- /** Reads an long value from an entire line of the default input.
- *
- * @return the Long that was read
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to a Long
- */
- def readLong(): Long = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toLong
- }
+private[scala] abstract class DeprecatedConsole {
+ self: Console.type =>
+
+ /** Internal usage only. */
+ protected def setOutDirect(out: PrintStream): Unit
+ protected def setErrDirect(err: PrintStream): Unit
+ protected def setInDirect(in: BufferedReader): Unit
+
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readBoolean(): Boolean = ReadStdin.readBoolean()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readByte(): Byte = ReadStdin.readByte()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readChar(): Char = ReadStdin.readChar()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readDouble(): Double = ReadStdin.readDouble()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readFloat(): Float = ReadStdin.readFloat()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readInt(): Int = ReadStdin.readInt()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLine(): String = ReadStdin.readLine()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLine(text: String, args: Any*): String = ReadStdin.readLine(text, args: _*)
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLong(): Long = ReadStdin.readLong()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readShort(): Short = ReadStdin.readShort()
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf(format: String): List[Any] = ReadStdin.readf(format)
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf1(format: String): Any = ReadStdin.readf1(format)
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf2(format: String): (Any, Any) = ReadStdin.readf2(format)
+ @deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf3(format: String): (Any, Any, Any) = ReadStdin.readf3(format)
- /** Reads a float value from an entire line of the default input.
- * @return the Float that was read.
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to a Float
+ /** Sets the default output stream.
*
+ * @param out the new output stream.
*/
- def readFloat(): Float = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toFloat
- }
+ @deprecated("Use withOut", "2.11.0") def setOut(out: PrintStream): Unit = setOutDirect(out)
- /** Reads a double value from an entire line of the default input.
+ /** Sets the default output stream.
*
- * @return the Double that was read.
- * @throws java.io.EOFException if the end of the
- * input stream has been reached.
- * @throws java.lang.NumberFormatException if the value couldn't be converted to a Float
+ * @param out the new output stream.
*/
- def readDouble(): Double = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- s.toDouble
- }
+ @deprecated("Use withOut", "2.11.0") def setOut(out: OutputStream): Unit = setOutDirect(new PrintStream(out))
- /** Reads in some structured input (from the default input), specified by
- * a format specifier. See class `java.text.MessageFormat` for details of
- * the format specification.
+ /** Sets the default error stream.
*
- * @param format the format of the input.
- * @return a list of all extracted values.
- * @throws java.io.EOFException if the end of the input stream has been
- * reached.
+ * @param err the new error stream.
*/
- def readf(format: String): List[Any] = {
- val s = readLine()
- if (s == null)
- throw new java.io.EOFException("Console has reached end of input")
- else
- textComponents(new MessageFormat(format).parse(s))
- }
+ @deprecated("Use withErr", "2.11.0") def setErr(err: PrintStream): Unit = setErrDirect(err)
- /** Reads in some structured input (from the default input), specified by
- * a format specifier, returning only the first value extracted, according
- * to the format specification.
+ /** Sets the default error stream.
*
- * @param format format string, as accepted by `readf`.
- * @return The first value that was extracted from the input
+ * @param err the new error stream.
*/
- def readf1(format: String): Any = readf(format).head
+ @deprecated("Use withErr", "2.11.0") def setErr(err: OutputStream): Unit = setErrDirect(new PrintStream(err))
- /** Reads in some structured input (from the default input), specified
- * by a format specifier, returning only the first two values extracted,
- * according to the format specification.
+ /** Sets the default input stream.
*
- * @param format format string, as accepted by `readf`.
- * @return A [[scala.Tuple2]] containing the first two values extracted
+ * @param reader specifies the new input stream.
*/
- def readf2(format: String): (Any, Any) = {
- val res = readf(format)
- (res.head, res.tail.head)
- }
+ @deprecated("Use withIn", "2.11.0") def setIn(reader: Reader): Unit = setInDirect(new BufferedReader(reader))
- /** Reads in some structured input (from the default input), specified
- * by a format specifier, returning only the first three values extracted,
- * according to the format specification.
+ /** Sets the default input stream.
*
- * @param format format string, as accepted by `readf`.
- * @return A [[scala.Tuple3]] containing the first three values extracted
+ * @param in the new input stream.
*/
- def readf3(format: String): (Any, Any, Any) = {
- val res = readf(format)
- (res.head, res.tail.head, res.tail.tail.head)
- }
-
- private def textComponents(a: Array[AnyRef]): List[Any] = {
- var i: Int = a.length - 1
- var res: List[Any] = Nil
- while (i >= 0) {
- res = (a(i) match {
- case x: java.lang.Boolean => x.booleanValue()
- case x: java.lang.Byte => x.byteValue()
- case x: java.lang.Short => x.shortValue()
- case x: java.lang.Character => x.charValue()
- case x: java.lang.Integer => x.intValue()
- case x: java.lang.Long => x.longValue()
- case x: java.lang.Float => x.floatValue()
- case x: java.lang.Double => x.doubleValue()
- case x => x
- }) :: res;
- i -= 1
- }
- res
- }
+ @deprecated("Use withIn", "2.11.0") def setIn(in: InputStream): Unit = setInDirect(new BufferedReader(new InputStreamReader(in)))
}
View
2  src/library/scala/LowPriorityImplicits.scala
@@ -22,7 +22,7 @@ import scala.language.implicitConversions
* @author Martin Odersky
* @since 2.8
*/
-class LowPriorityImplicits {
+private[scala] abstract class LowPriorityImplicits {
/** We prefer the java.lang.* boxed types to these wrappers in
* any potential conflicts. Conflicts do exist because the wrappers
* need to implement ScalaNumber in order to have a symmetric equals
View
150 src/library/scala/Predef.scala
@@ -15,6 +15,7 @@ import generic.CanBuildFrom
import scala.annotation.{ elidable, implicitNotFound }
import scala.annotation.elidable.ASSERTION
import scala.language.{implicitConversions, existentials}
+import scala.io.ReadStdin
/** The `Predef` object provides definitions that are accessible in all Scala
* compilation units without explicit qualification.
@@ -68,7 +69,7 @@ import scala.language.{implicitConversions, existentials}
* Short value to a Long value as required, and to add additional higher-order
* functions to Array values. These are described in more detail in the documentation of [[scala.Array]].
*/
-object Predef extends LowPriorityImplicits {
+object Predef extends LowPriorityImplicits with DeprecatedPredef {
/**
* Retrieve the runtime representation of a class type. `classOf[T]` is equivalent to
* the class literal `T.class` in Java.
@@ -101,19 +102,19 @@ object Predef extends LowPriorityImplicits {
// Manifest types, companions, and incantations for summoning
@annotation.implicitNotFound(msg = "No ClassManifest available for ${T}.")
- @deprecated("Use scala.reflect.ClassTag instead", "2.10.0")
+ @deprecated("Use `scala.reflect.ClassTag` instead", "2.10.0")
type ClassManifest[T] = scala.reflect.ClassManifest[T]
// TODO undeprecated until Scala reflection becomes non-experimental
// @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0")
type OptManifest[T] = scala.reflect.OptManifest[T]
@annotation.implicitNotFound(msg = "No Manifest available for ${T}.")
// TODO undeprecated until Scala reflection becomes non-experimental
- // @deprecated("Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead", "2.10.0")
+ // @deprecated("Use `scala.reflect.ClassTag` (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead", "2.10.0")
type Manifest[T] = scala.reflect.Manifest[T]
- @deprecated("Use scala.reflect.ClassTag instead", "2.10.0")
+ @deprecated("Use `scala.reflect.ClassTag` instead", "2.10.0")
val ClassManifest = scala.reflect.ClassManifest
// TODO undeprecated until Scala reflection becomes non-experimental
- // @deprecated("Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead", "2.10.0")
+ // @deprecated("Use `scala.reflect.ClassTag` (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead", "2.10.0")
val Manifest = scala.reflect.Manifest
// TODO undeprecated until Scala reflection becomes non-experimental
// @deprecated("This notion doesn't have a corresponding concept in 2.10, because scala.reflect.runtime.universe.TypeTag can capture arbitrary types. Use type tags instead of manifests, and there will be no need in opt manifests.", "2.10.0")
@@ -136,19 +137,14 @@ object Predef extends LowPriorityImplicits {
// Apparently needed for the xml library
val $scope = scala.xml.TopScope
- // Deprecated
+ // errors and asserts -------------------------------------------------
+ // !!! Remove this when possible - ideally for 2.11.
+ // We are stuck with it a while longer because sbt's compiler interface
+ // still calls it as of 0.12.2.
@deprecated("Use `sys.error(message)` instead", "2.9.0")
def error(message: String): Nothing = sys.error(message)
- @deprecated("Use `sys.exit()` instead", "2.9.0")
- def exit(): Nothing = sys.exit()
-
- @deprecated("Use `sys.exit(status)` instead", "2.9.0")
- def exit(status: Int): Nothing = sys.exit(status)
-
- // errors and asserts -------------------------------------------------
-
/** Tests an expression, throwing an `AssertionError` if false.
* Calls to this method will not be generated if `-Xelide-below`
* is at least `ASSERTION`.
@@ -230,17 +226,6 @@ object Predef extends LowPriorityImplicits {
throw new IllegalArgumentException("requirement failed: "+ message)
}
- final class Ensuring[A](val __resultOfEnsuring: A) extends AnyVal {
- // `__resultOfEnsuring` must be a public val to allow inlining.
- // See comments in ArrowAssoc for more.
-
- def ensuring(cond: Boolean): A = { assert(cond); __resultOfEnsuring }
- def ensuring(cond: Boolean, msg: => Any): A = { assert(cond, msg); __resultOfEnsuring }
- def ensuring(cond: A => Boolean): A = { assert(cond(__resultOfEnsuring)); __resultOfEnsuring }
- def ensuring(cond: A => Boolean, msg: => Any): A = { assert(cond(__resultOfEnsuring), msg); __resultOfEnsuring }
- }
- @inline implicit def any2Ensuring[A](x: A): Ensuring[A] = new Ensuring(x)
-
/** `???` can be used for marking methods that remain to be implemented.
* @throws A `NotImplementedError`
*/
@@ -260,17 +245,58 @@ object Predef extends LowPriorityImplicits {
def unapply[A, B, C](x: Tuple3[A, B, C]): Option[Tuple3[A, B, C]] = Some(x)
}
- final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal {
- // `__leftOfArrow` must be a public val to allow inlining. The val
- // used to be called `x`, but now goes by `__leftOfArrow`, as that
- // reduces the chances of a user's writing `foo.__leftOfArrow` and
- // being confused why they get an ambiguous implicit conversion
- // error. (`foo.x` used to produce this error since both
- // any2Ensuring and any2ArrowAssoc enrich everything with an `x`)
+ // implicit classes -----------------------------------------------------
+
+ implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal {
@inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y)
def [B](y: B): Tuple2[A, B] = ->(y)
}
- @inline implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A] = new ArrowAssoc(x)
+
+ implicit final class Ensuring[A](val __resultOfEnsuring: A) extends AnyVal {
+ def ensuring(cond: Boolean): A = { assert(cond); __resultOfEnsuring }
+ def ensuring(cond: Boolean, msg: => Any): A = { assert(cond, msg); __resultOfEnsuring }
+ def ensuring(cond: A => Boolean): A = { assert(cond(__resultOfEnsuring)); __resultOfEnsuring }
+ def ensuring(cond: A => Boolean, msg: => Any): A = { assert(cond(__resultOfEnsuring), msg); __resultOfEnsuring }
+ }
+
+ implicit final class StringFormat[A](val __stringToFormat: A) extends AnyVal {
+ /** Returns string formatted according to given `format` string.
+ * Format strings are as for `String.format`
+ * (@see java.lang.String.format).
+ */
+ @inline def formatted(fmtstr: String): String = fmtstr format __stringToFormat
+ }
+
+ implicit final class StringAdd[A](val __thingToAdd: A) extends AnyVal {
+ def +(other: String) = String.valueOf(__thingToAdd) + other
+ }
+
+ implicit final class RichException(val __throwableToEnrich: Throwable) extends AnyVal {
+ import scala.compat.Platform.EOL
+ @deprecated("Use Throwable#getStackTrace", "2.11.0") def getStackTraceString = __throwableToEnrich.getStackTrace().mkString("", EOL, EOL)
+ }
+
+ implicit final class SeqCharSequence(val __sequenceOfChars: scala.collection.IndexedSeq[Char]) extends CharSequence {
+ def length: Int = __sequenceOfChars.length
+ def charAt(index: Int): Char = __sequenceOfChars(index)
+ def subSequence(start: Int, end: Int): CharSequence = new SeqCharSequence(__sequenceOfChars.slice(start, end))
+ override def toString = __sequenceOfChars mkString ""
+ }
+
+ implicit final class ArrayCharSequence(val __arrayOfChars: Array[Char]) extends CharSequence {
+ def length: Int = __arrayOfChars.length
+ def charAt(index: Int): Char = __arrayOfChars(index)
+ def subSequence(start: Int, end: Int): CharSequence = new runtime.ArrayCharSequence(__arrayOfChars, start, end)
+ override def toString = __arrayOfChars mkString ""
+ }
+
+ implicit val StringCanBuildFrom: CanBuildFrom[String, Char, String] = new CanBuildFrom[String, Char, String] {
+ def apply(from: String) = apply()
+ def apply() = mutable.StringBuilder.newBuilder
+ }
+
+ @inline implicit def augmentString(x: String): StringOps = new StringOps(x)
+ @inline implicit def unaugmentString(x: StringOps): String = x.repr
// printing and reading -----------------------------------------------
@@ -279,28 +305,10 @@ object Predef extends LowPriorityImplicits {
def println(x: Any) = Console.println(x)
def printf(text: String, xs: Any*) = Console.print(text.format(xs: _*))
- def readLine(): String = Console.readLine()
- def readLine(text: String, args: Any*) = Console.readLine(text, args: _*)
- def readBoolean() = Console.readBoolean()
- def readByte() = Console.readByte()
- def readShort() = Console.readShort()
- def readChar() = Console.readChar()
- def readInt() = Console.readInt()
- def readLong() = Console.readLong()
- def readFloat() = Console.readFloat()
- def readDouble() = Console.readDouble()
- def readf(format: String) = Console.readf(format)
- def readf1(format: String) = Console.readf1(format)
- def readf2(format: String) = Console.readf2(format)
- def readf3(format: String) = Console.readf3(format)
-
// views --------------------------------------------------------------
- implicit def exceptionWrapper(exc: Throwable) = new runtime.RichException(exc)
implicit def tuple2ToZippedOps[T1, T2](x: (T1, T2)) = new runtime.Tuple2Zipped.Ops(x)
implicit def tuple3ToZippedOps[T1, T2, T3](x: (T1, T2, T3)) = new runtime.Tuple3Zipped.Ops(x)
- implicit def seqToCharSequence(xs: scala.collection.IndexedSeq[Char]): CharSequence = new runtime.SeqCharSequence(xs)
- implicit def arrayToCharSequence(xs: Array[Char]): CharSequence = new runtime.ArrayCharSequence(xs, 0, xs.length)
implicit def genericArrayOps[T](xs: Array[T]): ArrayOps[T] = (xs match {
case x: Array[AnyRef] => refArrayOps[AnyRef](x)
@@ -360,18 +368,6 @@ object Predef extends LowPriorityImplicits {
implicit def Double2double(x: java.lang.Double): Double = x.doubleValue
implicit def Boolean2boolean(x: java.lang.Boolean): Boolean = x.booleanValue
- // Strings and CharSequences --------------------------------------------------------------
-
- @inline implicit def any2stringfmt(x: Any) = new runtime.StringFormat(x)
- @inline implicit def augmentString(x: String): StringOps = new StringOps(x)
- implicit def any2stringadd(x: Any) = new runtime.StringAdd(x)
- implicit def unaugmentString(x: StringOps): String = x.repr
-
- implicit val StringCanBuildFrom: CanBuildFrom[String, Char, String] = new CanBuildFrom[String, Char, String] {
- def apply(from: String) = apply()
- def apply() = mutable.StringBuilder.newBuilder
- }
-
// Type Constraints --------------------------------------------------------------
/**
@@ -422,3 +418,31 @@ object Predef extends LowPriorityImplicits {
implicit def dummyImplicit: DummyImplicit = new DummyImplicit
}
}
+
+private[scala] trait DeprecatedPredef {
+ self: Predef.type =>
+
+ // Deprecated stubs for any who may have been calling these methods directly.
+ @deprecated("Use `ArrowAssoc`", "2.11.0") def any2ArrowAssoc[A](x: A): ArrowAssoc[A] = new ArrowAssoc(x)
+ @deprecated("Use `Ensuring`", "2.11.0") def any2Ensuring[A](x: A): Ensuring[A] = new Ensuring(x)
+ @deprecated("Use `StringFormat`", "2.11.0") def any2stringfmt(x: Any): StringFormat[Any] = new StringFormat(x)
+ @deprecated("Use String interpolation", "2.11.0") def any2stringadd(x: Any): StringAdd[Any] = new StringAdd(x)
+ @deprecated("Use `Throwable` directly", "2.11.0") def exceptionWrapper(exc: Throwable) = new RichException(exc)
+ @deprecated("Use `SeqCharSequence`", "2.11.0") def seqToCharSequence(xs: scala.collection.IndexedSeq[Char]): CharSequence = new SeqCharSequence(xs)
+ @deprecated("Use `ArrayCharSequence`", "2.11.0") def arrayToCharSequence(xs: Array[Char]): CharSequence = new ArrayCharSequence(xs)
+
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLine(): String = ReadStdin.readLine()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLine(text: String, args: Any*) = ReadStdin.readLine(text, args: _*)
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readBoolean() = ReadStdin.readBoolean()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readByte() = ReadStdin.readByte()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readShort() = ReadStdin.readShort()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readChar() = ReadStdin.readChar()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readInt() = ReadStdin.readInt()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLong() = ReadStdin.readLong()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readFloat() = ReadStdin.readFloat()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readDouble() = ReadStdin.readDouble()
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf(format: String) = ReadStdin.readf(format)
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf1(format: String) = ReadStdin.readf1(format)
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf2(format: String) = ReadStdin.readf2(format)
+ @deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf3(format: String) = ReadStdin.readf3(format)
+}
View
53 src/library/scala/io/AnsiColor.scala
@@ -0,0 +1,53 @@
+package scala
+package io
+
+trait AnsiColor {
+ /** Foreground color for ANSI black */
+ final val BLACK = "\033[30m"
+ /** Foreground color for ANSI red */
+ final val RED = "\033[31m"
+ /** Foreground color for ANSI green */
+ final val GREEN = "\033[32m"
+ /** Foreground color for ANSI yellow */
+ final val YELLOW = "\033[33m"
+ /** Foreground color for ANSI blue */
+ final val BLUE = "\033[34m"
+ /** Foreground color for ANSI magenta */
+ final val MAGENTA = "\033[35m"
+ /** Foreground color for ANSI cyan */
+ final val CYAN = "\033[36m"
+ /** Foreground color for ANSI white */
+ final val WHITE = "\033[37m"
+
+ /** Background color for ANSI black */
+ final val BLACK_B = "\033[40m"
+ /** Background color for ANSI red */
+ final val RED_B = "\033[41m"
+ /** Background color for ANSI green */
+ final val GREEN_B = "\033[42m"
+ /** Background color for ANSI yellow */
+ final val YELLOW_B = "\033[43m"
+ /** Background color for ANSI blue */
+ final val BLUE_B = "\033[44m"
+ /** Background color for ANSI magenta */
+ final val MAGENTA_B = "\033[45m"
+ /** Background color for ANSI cyan */
+ final val CYAN_B = "\033[46m"
+ /** Background color for ANSI white */
+ final val WHITE_B = "\033[47m"
+
+ /** Reset ANSI styles */
+ final val RESET = "\033[0m"
+ /** ANSI bold */
+ final val BOLD = "\033[1m"
+ /** ANSI underlines */
+ final val UNDERLINED = "\033[4m"
+ /** ANSI blink */
+ final val BLINK = "\033[5m"
+ /** ANSI reversed */
+ final val REVERSED = "\033[7m"
+ /** ANSI invisible */
+ final val INVISIBLE = "\033[8m"
+}
+
+object AnsiColor extends AnsiColor { }
View
228 src/library/scala/io/ReadStdin.scala
@@ -0,0 +1,228 @@
+package scala
+package io
+
+import java.text.MessageFormat
+
+/** private[scala] because this is not functionality we should be providing
+ * in the standard library, at least not in this idiosyncractic form.
+ * Factored into trait because it is better code structure regardless.
+ */
+private[scala] trait ReadStdin {
+ import scala.Console._
+
+ /** Read a full line from the default input. Returns `null` if the end of the
+ * input stream has been reached.
+ *
+ * @return the string read from the terminal or null if the end of stream was reached.
+ */
+ def readLine(): String = in.readLine()
+
+ /** Print formatted text to the default output and read a full line from the default input.
+ * Returns `null` if the end of the input stream has been reached.
+ *
+ * @param text the format of the text to print out, as in `printf`.
+ * @param args the parameters used to instantiate the format, as in `printf`.
+ * @return the string read from the default input
+ */
+ def readLine(text: String, args: Any*): String = {
+ printf(text, args: _*)
+ readLine()
+ }
+
+ /** Reads a boolean value from an entire line of the default input.
+ * Has a fairly liberal interpretation of the input.
+ *
+ * @return the boolean value read, or false if it couldn't be converted to a boolean
+ * @throws java.io.EOFException if the end of the input stream has been reached.
+ */
+ def readBoolean(): Boolean = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toLowerCase() match {
+ case "true" => true
+ case "t" => true
+ case "yes" => true
+ case "y" => true
+ case _ => false
+ }
+ }
+
+ /** Reads a byte value from an entire line of the default input.
+ *
+ * @return the Byte that was read
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to a Byte
+ */
+ def readByte(): Byte = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toByte
+ }
+
+ /** Reads a short value from an entire line of the default input.
+ *
+ * @return the short that was read
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to a Short
+ */
+ def readShort(): Short = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toShort
+ }
+
+ /** Reads a char value from an entire line of the default input.
+ *
+ * @return the Char that was read
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.StringIndexOutOfBoundsException if the line read from default input was empty
+ */
+ def readChar(): Char = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s charAt 0
+ }
+
+ /** Reads an int value from an entire line of the default input.
+ *
+ * @return the Int that was read
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to an Int
+ */
+ def readInt(): Int = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toInt
+ }
+
+ /** Reads an long value from an entire line of the default input.
+ *
+ * @return the Long that was read
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to a Long
+ */
+ def readLong(): Long = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toLong
+ }
+
+ /** Reads a float value from an entire line of the default input.
+ * @return the Float that was read.
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to a Float
+ *
+ */
+ def readFloat(): Float = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toFloat
+ }
+
+ /** Reads a double value from an entire line of the default input.
+ *
+ * @return the Double that was read.
+ * @throws java.io.EOFException if the end of the
+ * input stream has been reached.
+ * @throws java.lang.NumberFormatException if the value couldn't be converted to a Float
+ */
+ def readDouble(): Double = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ s.toDouble
+ }
+
+ /** Reads in some structured input (from the default input), specified by
+ * a format specifier. See class `java.text.MessageFormat` for details of
+ * the format specification.
+ *
+ * @param format the format of the input.
+ * @return a list of all extracted values.
+ * @throws java.io.EOFException if the end of the input stream has been
+ * reached.
+ */
+ def readf(format: String): List[Any] = {
+ val s = readLine()
+ if (s == null)
+ throw new java.io.EOFException("Console has reached end of input")
+ else
+ textComponents(new MessageFormat(format).parse(s))
+ }
+
+ /** Reads in some structured input (from the default input), specified by
+ * a format specifier, returning only the first value extracted, according
+ * to the format specification.
+ *
+ * @param format format string, as accepted by `readf`.
+ * @return The first value that was extracted from the input
+ */
+ def readf1(format: String): Any = readf(format).head
+
+ /** Reads in some structured input (from the default input), specified
+ * by a format specifier, returning only the first two values extracted,
+ * according to the format specification.
+ *
+ * @param format format string, as accepted by `readf`.
+ * @return A [[scala.Tuple2]] containing the first two values extracted
+ */
+ def readf2(format: String): (Any, Any) = {
+ val res = readf(format)
+ (res.head, res.tail.head)
+ }
+
+ /** Reads in some structured input (from the default input), specified
+ * by a format specifier, returning only the first three values extracted,
+ * according to the format specification.
+ *
+ * @param format format string, as accepted by `readf`.
+ * @return A [[scala.Tuple3]] containing the first three values extracted
+ */
+ def readf3(format: String): (Any, Any, Any) = {
+ val res = readf(format)
+ (res.head, res.tail.head, res.tail.tail.head)
+ }
+
+ private def textComponents(a: Array[AnyRef]): List[Any] = {
+ var i: Int = a.length - 1
+ var res: List[Any] = Nil
+ while (i >= 0) {
+ res = (a(i) match {
+ case x: java.lang.Boolean => x.booleanValue()
+ case x: java.lang.Byte => x.byteValue()
+ case x: java.lang.Short => x.shortValue()
+ case x: java.lang.Character => x.charValue()
+ case x: java.lang.Integer => x.intValue()
+ case x: java.lang.Long => x.longValue()
+ case x: java.lang.Float => x.floatValue()
+ case x: java.lang.Double => x.doubleValue()
+ case x => x
+ }) :: res;
+ i -= 1
+ }
+ res
+ }
+}
+
+object ReadStdin extends ReadStdin { }
View
1  src/library/scala/runtime/RichException.scala
@@ -10,6 +10,7 @@ package scala.runtime
import scala.compat.Platform.EOL
+@deprecated("Use Throwable#getStackTrace", "2.11.0")
final class RichException(exc: Throwable) {
def getStackTraceString = exc.getStackTrace().mkString("", EOL, EOL)
}
View
3  src/library/scala/runtime/SeqCharSequence.scala
@@ -11,6 +11,7 @@ package runtime
import java.util.Arrays.copyOfRange
+@deprecated("Use Predef.SeqCharSequence", "2.11.0")
final class SeqCharSequence(val xs: scala.collection.IndexedSeq[Char]) extends CharSequence {
def length: Int = xs.length
def charAt(index: Int): Char = xs(index)
@@ -18,6 +19,8 @@ final class SeqCharSequence(val xs: scala.collection.IndexedSeq[Char]) extends C
override def toString = xs.mkString("")
}
+// Still need this one since the implicit class ArrayCharSequence only converts
+// a single argument.
final class ArrayCharSequence(val xs: Array[Char], start: Int, end: Int) extends CharSequence {
// yikes
// java.lang.VerifyError: (class: scala/runtime/ArrayCharSequence, method: <init> signature: ([C)V)
View
1  src/library/scala/runtime/StringAdd.scala
@@ -9,6 +9,7 @@
package scala.runtime
/** A wrapper class that adds string concatenation `+` to any value */
+@deprecated("Use Predef.StringAdd", "2.11.0")
final class StringAdd(val self: Any) extends AnyVal {
def +(other: String) = String.valueOf(self) + other
}
View
1  src/library/scala/runtime/StringFormat.scala
@@ -10,6 +10,7 @@ package scala.runtime
/** A wrapper class that adds a `formatted` operation to any value
*/
+@deprecated("Use Predef.StringFormat", "2.11.0")
final class StringFormat(val self: Any) extends AnyVal {
/** Returns string formatted according to given `format` string.
* Format strings are as for `String.format`
View
2  test/files/instrumented/InstrumentationTest.check
@@ -4,5 +4,7 @@ Method call statistics:
1 Foo1.someMethod()I
1 instrumented/Foo2.<init>()V
1 instrumented/Foo2.someMethod()I
+ 1 scala/DeprecatedConsole.<init>()V
1 scala/Predef$.println(Ljava/lang/Object;)V
+ 1 scala/io/AnsiColor$class.$init$(Lscala/io/AnsiColor;)V
1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean;
View
10 test/files/neg/classmanifests_new_deprecations.check
@@ -1,13 +1,13 @@
-classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
def cm1[T: ClassManifest] = ???
^
-classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
^
-classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
val cm3: ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
val cm3: ClassManifest[Int] = null
^
classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
@@ -22,7 +22,7 @@ classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package
classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
val rcm3: scala.reflect.ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
type CM[T] = ClassManifest[T]
^
classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
View
4 test/files/neg/logImplicits.check
@@ -7,10 +7,10 @@ logImplicits.scala:7: applied implicit conversion from String("abc") to ?{def ma
logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String("abc"))Int
math.max(122, x: Int)
^
-logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A]
+logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def ArrowAssoc[A](__leftOfArrow: A): ArrowAssoc[A]
def f = (1 -> 2) + "c"
^
-logImplicits.scala:19: applied implicit conversion from (Int, Int) to ?{def +: ?} = implicit def any2stringadd(x: Any): scala.runtime.StringAdd
+logImplicits.scala:19: applied implicit conversion from (Int, Int) to ?{def +: ?} = implicit def StringAdd[A](__thingToAdd: A): StringAdd[A]
def f = (1 -> 2) + "c"
^
logImplicits.scala:22: error: class Un needs to be abstract, since method unimplemented is not defined
View
2  test/files/neg/predef-masking.scala
@@ -1,5 +1,5 @@
// Testing predef masking
-import Predef.{ any2stringadd => _, _ }
+import Predef.{ StringAdd => _, _ }
object StringPlusConfusion {
// Would love to do something about this error message, but by the
View
4 test/files/neg/t1010.scala
@@ -6,9 +6,9 @@ class MailBox {
abstract class Actor {
private val in = new MailBox
- def send(msg: in.Message) = error("foo")
+ def send(msg: in.Message) = sys.error("foo")
- def unstable: Actor = error("foo")
+ def unstable: Actor = sys.error("foo")
def dubiousSend(msg: MailBox#Message): Nothing =
unstable.send(msg) // in.Message becomes unstable.Message, but that's ok since Message is a concrete type member
View
2  test/files/neg/t414.scala
@@ -3,7 +3,7 @@ case class Node[a](left: IntMap[a], keyVal: Pair[Int, a], right: IntMap[a]) exte
abstract class IntMap[a] {
def lookup(key: Int): a = this match {
case Empty =>
- error("clef inexistante")
+ sys.error("clef inexistante")
case _ =>
};
View
2  test/files/neg/t421.check
@@ -1,4 +1,4 @@
t421.scala:5: error: star patterns must correspond with varargs parameters
- case Bar("foo",_*) => error("huh?");
+ case Bar("foo",_*) => sys.error("huh?");
^
one error found
View
2  test/files/neg/t421.scala
@@ -2,7 +2,7 @@ object foo {
case class Bar(a:String, b:AnyRef, c:String*);
Bar("foo","meets","bar") match {
- case Bar("foo",_*) => error("huh?");
+ case Bar("foo",_*) => sys.error("huh?");
}
}
View
4 test/files/neg/t4271.scala
@@ -1,11 +1,11 @@
object foo {
object Donotuseme
- implicit def any2Ensuring[A](x: A) = Donotuseme
+ implicit def Ensuring[A](x: A) = Donotuseme
implicit def doubleWrapper(x: Int) = Donotuseme
implicit def floatWrapper(x: Int) = Donotuseme
implicit def intWrapper(x: Int) = Donotuseme
implicit def longWrapper(x: Int) = Donotuseme
- implicit def any2ArrowAssoc[A](x: A) = Donotuseme
+ implicit def ArrowAssoc[A](x: A) = Donotuseme
3 to 5
5 ensuring true
3 -> 5
View
6 test/files/pos/List1.scala
@@ -9,15 +9,15 @@ object lists {
def Nil[b] = new List[b] {
def isEmpty: Boolean = true;
- def head = error("head of Nil");
- def tail = error("tail of Nil");
+ def head = sys.error("head of Nil");
+ def tail = sys.error("tail of Nil");
}
def Cons[c](x: c, xs: List[c]): List[c] = new List[c] {
def isEmpty = false;
def head = x;
def tail = xs;
- }
+ }
def foo = {
val intnil = Nil[Int];
View
6 test/files/pos/depmet_implicit_chaining_zw.scala
@@ -3,7 +3,7 @@ trait Succ[N]
trait ZipWith[N, S] {
type T
- val x: T = error("")
+ val x: T = sys.error("")
}
object ZipWith {
@@ -15,7 +15,7 @@ object ZipWith {
type T = Stream[S] => zWith.T // dependent types replace the associated types functionality
}
- // can't use implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]],
+ // can't use implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]],
// since that will chop of the {type T = ... } refinement in adapt (pt = ZipWith[Succ[Succ[Zero]], Int => String => Boolean])
// this works
// def zipWith(implicit zw: ZipWith[Succ[Succ[Zero]], Int => String => Boolean]): zw.T = zw.x
@@ -25,4 +25,4 @@ object ZipWith {
type _2 = Succ[Succ[Zero]]
val zw = ?[ZipWith[_2, Int => String => Boolean]].x // : Stream[Int] => Stream[String] => Stream[Boolean]
// val zw = implicitly[ZipWith[Succ[Succ[Zero]], Int => String => Boolean]{type T = Stream[Int] => Stream[String] => Stream[Boolean]}].x
-}
+}
View
20 test/files/pos/depmet_implicit_norm_ret.scala
@@ -1,29 +1,29 @@
object Test{
def ?[S <: AnyRef](implicit w : S) : w.type = w
-
+
// fallback, lower priority (overloading rules apply: pick alternative in subclass lowest in subtyping lattice)
class ZipWithDefault {
implicit def ZeroZipWith[S] = new ZipWith[S] {
type T = Stream[S]
- }
+ }
}
-
+
object ZipWith extends ZipWithDefault {
// def apply[S: ZipWith](s : S) = ?[ZipWith[S]].zipWith(s) // TODO: bug return type should be inferred
def apply[S](s : S)(implicit zw: ZipWith[S]): zw.T = zw.zipWith(s)
implicit def SuccZipWith[S,R](implicit zWith : ZipWith[R]) = new ZipWith[S => R] {
type T = Stream[S] => zWith.T // dependent types replace the associated types functionality
- }
+ }
}
-
+
trait ZipWith[S] {
type T
- def zipWith : S => T = error("")
+ def zipWith : S => T = sys.error("")
}
-
+
// bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T
// this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731
- def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f)
- val tst: Stream[Int] = map{x: String => x.length}(Stream("a"))
-}
+ def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f)
+ val tst: Stream[Int] = map{x: String => x.length}(Stream("a"))
+}
View
8 test/files/pos/implicits-new.scala
@@ -3,9 +3,9 @@ import scala.reflect.{ClassTag, classTag}
// #1435
object t1435 {
- implicit def a(s:String):String = error("")
- implicit def a(i:Int):String = error("")
- implicit def b(i:Int):String = error("")
+ implicit def a(s:String):String = sys.error("")
+ implicit def a(i:Int):String = sys.error("")
+ implicit def b(i:Int):String = sys.error("")
}
class C1435 {
@@ -89,4 +89,4 @@ package foo2709 {
// Problem with specs
object specsProblem {
println(implicitly[TypeTag[Class[_]]])
-}
+}
View
40 test/files/pos/implicits-old.scala
@@ -1,8 +1,8 @@
// #1435
object t1435 {
- implicit def a(s:String):String = error("")
- implicit def a(i:Int):String = error("")
- implicit def b(i:Int):String = error("")
+ implicit def a(s:String):String = sys.error("")
+ implicit def a(i:Int):String = sys.error("")
+ implicit def b(i:Int):String = sys.error("")
}
class C1435 {
@@ -45,7 +45,7 @@ object Test1625 {
implicit def byName[A](x: =>A) = new Wrapped(x)
implicit def byVal[A](x: A) = x
-
+
def main(args: Array[String]) = {
// val res:Wrapped = 7 // works
@@ -57,7 +57,7 @@ object Test1625 {
}
object Test2188 {
- implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*)
+ implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*)
val x: java.util.List[String] = List("foo")
}
@@ -67,21 +67,21 @@ object TestNumericWidening {
val x: java.lang.Long = y
}
-// #2709
-package foo2709 {
- class A
- class B
-
- package object bar {
- implicit def a2b(a: A): B = new B
- }
-
- package bar {
- object test {
- new A: B
- }
- }
-}
+// #2709
+package foo2709 {
+ class A
+ class B
+
+ package object bar {
+ implicit def a2b(a: A): B = new B
+ }
+
+ package bar {
+ object test {
+ new A: B
+ }
+ }
+}
// Problem with specs
object specsProblem {
View
6 test/files/pos/relax_implicit_divergence.scala
@@ -1,7 +1,7 @@
class A(val options: Seq[String])
object Test {
- implicit def ss: Equiv[Seq[String]] = error("dummy")
- implicit def equivA(implicit seqEq: Equiv[Seq[String]]): Equiv[A] = error("dummy")
+ implicit def ss: Equiv[Seq[String]] = sys.error("dummy")
+ implicit def equivA(implicit seqEq: Equiv[Seq[String]]): Equiv[A] = sys.error("dummy")
implicitly[Equiv[A]]
-}
+}
View
2  test/files/pos/simple-exceptions.scala
@@ -8,7 +8,7 @@ object Test {
try {
try {
Console.println("hi!")
- error("xx")
+ sys.error("xx")
}
finally Console.println("ho!")
}
View
6 test/files/pos/spec-asseenfrom.scala
@@ -1,8 +1,8 @@
-class Automaton[@specialized(Double) W,State] {
+class Automaton[@specialized(Double) W,State] {
- def finalWeight(s: State): W = error("todo");
+ def finalWeight(s: State): W = sys.error("todo");
- def allStates: Set[State] = error("toodo");
+ def allStates: Set[State] = sys.error("toodo");
/**
* Returns a map from states to its final weight. may expand all nodes.
View
10 test/files/pos/spec-cyclic.scala
@@ -6,25 +6,25 @@ trait MyPartialFunction[-A, +B] extends AnyRef with AbsFun[A, B]
trait ColMap[A, +B] extends MyPartialFunction[A, B] /*with Collection[(A, B)] */
-trait ColSorted[K,+A] extends ColRanged[K,A]
+trait ColSorted[K,+A] extends ColRanged[K,A]
-trait ColSortedMap[K,+E] extends ColMap[K,E] with ColSorted[K,Tuple2[K,E]]
+trait ColSortedMap[K,+E] extends ColMap[K,E] with ColSorted[K,Tuple2[K,E]]
trait MutMap[A, B] extends AnyRef
with ColMap[A, B]
-trait ColRanged[K, +A] //extends Iterable[A]
+trait ColRanged[K, +A] //extends Iterable[A]
trait JclRanged[K,A] extends ColRanged[K,A] //with MutableIterable[A] {
-trait JclMap[K,E] extends /*collection.jcl.MutableIterable[Tuple2[K,E]] with*/ MutMap[K,E]
+trait JclMap[K,E] extends /*collection.jcl.MutableIterable[Tuple2[K,E]] with*/ MutMap[K,E]
trait JclSorted[K,A] extends ColSorted[K,A] with JclRanged[K,A]
trait JclSortedMap[K,E] extends ColSortedMap[K,E] with JclMap[K,E] with JclSorted[K,Tuple2[K,E]]
class Foo[A, B] extends JclSortedMap[A, B] {
- def apply(x: A): B = error("NYI")
+ def apply(x: A): B = sys.error("NYI")
}
class Bar {
View
8 test/files/pos/spec-sealed.scala
@@ -2,13 +2,13 @@ sealed abstract class MyList[@specialized +A] {
def head: A
def tail: MyList[A]
- def ::[@specialized B >: A](x: B): MyList[B] =
+ def ::[@specialized B >: A](x: B): MyList[B] =
new Cons[B](x, this)
}
case object MyNil extends MyList[Nothing] {
- def head = error("nil")
- def tail = error("nil")
+ def head = sys.error("nil")
+ def tail = sys.error("nil")
}
case class Cons[@specialized a](private val hd: a, tl: MyList[a]) extends MyList[a] {
@@ -19,7 +19,7 @@ case class Cons[@specialized a](private val hd: a, tl: MyList[a]) extends MyList
abstract class IntList extends MyList[Int]
object Main extends App {
- val xs = 1 :: 2 :: 3 :: MyNil
+ val xs = 1 :: 2 :: 3 :: MyNil
println(xs)
}
View
16 test/files/pos/spec-sparsearray-new.scala
@@ -4,7 +4,7 @@ import scala.collection.mutable.MapLike
class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] {
override def get(x: Int) = {
val ind = findOffset(x)
- if(ind < 0) None else Some(error("ignore"))
+ if(ind < 0) None else Some(sys.error("ignore"))
}
/**
@@ -13,13 +13,13 @@ class SparseArray[@specialized(Int) T:ClassTag] extends collection.mutable.Map[I
* negative and can be converted into an insertion point with -(rv+1).
*/
private def findOffset(i : Int) : Int = {
- error("impl doesn't matter")
+ sys.error("impl doesn't matter")
}
- override def apply(i : Int) : T = { error("ignore") }
- override def update(i : Int, value : T) = error("ignore")
+ override def apply(i : Int) : T = { sys.error("ignore") }
+ override def update(i : Int, value : T) = sys.error("ignore")
override def empty = new SparseArray[T]
- def -=(ind: Int) = error("ignore")
- def +=(kv: (Int,T)) = error("ignore")
- override final def iterator = error("ignore")
-}
+ def -=(ind: Int) = sys.error("ignore")
+ def +=(kv: (Int,T)) = sys.error("ignore")
+ override final def iterator = sys.error("ignore")
+}
View
14 test/files/pos/spec-sparsearray-old.scala
@@ -3,7 +3,7 @@ import scala.collection.mutable.MapLike
class SparseArray[@specialized(Int) T:ClassManifest] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] {
override def get(x: Int) = {
val ind = findOffset(x)
- if(ind < 0) None else Some(error("ignore"))
+ if(ind < 0) None else Some(sys.error("ignore"))
}
/**
@@ -12,13 +12,13 @@ class SparseArray[@specialized(Int) T:ClassManifest] extends collection.mutable.
* negative and can be converted into an insertion point with -(rv+1).
*/
private def findOffset(i : Int) : Int = {
- error("impl doesn't matter")
+ sys.error("impl doesn't matter")
}
- override def apply(i : Int) : T = { error("ignore") }
- override def update(i : Int, value : T) = error("ignore")
+ override def apply(i : Int) : T = { sys.error("ignore") }
+ override def update(i : Int, value : T) = sys.error("ignore")
override def empty = new SparseArray[T]
- def -=(ind: Int) = error("ignore")
- def +=(kv: (Int,T)) = error("ignore")
- override final def iterator = error("ignore")
+ def -=(ind: Int) = sys.error("ignore")
+ def +=(kv: (Int,T)) = sys.error("ignore")
+ override final def iterator = sys.error("ignore")
}
View
12 test/files/pos/spec-traits.scala
@@ -11,19 +11,19 @@ class Lazy {
// issue 3307
class Bug3307 {
- def f[Z](block: String => Z) {
- block("abc")
+ def f[Z](block: String => Z) {
+ block("abc")
}
-
- ({ () =>
- f { implicit x => println(x) } })()
+
+ ({ () =>
+ f { implicit x => println(x) } })()
}
// issue 3301
trait T[X]
class Bug3301 {
- def t[A]: T[A] = error("stub")
+ def t[A]: T[A] = sys.error("stub")
() => {
type X = Int
View
6 test/files/pos/t0031.scala
@@ -4,17 +4,17 @@ object Main {
def ensure(postcondition: a => Boolean): a
}
- def require[a](precondition: => Boolean)(command: => a): Ensure[a] =
+ def require[a](precondition: => Boolean)(command: => a): Ensure[a] =
if (precondition)
new Ensure[a] {
def ensure(postcondition: a => Boolean): a = {
val result = command;
if (postcondition(result)) result
- else error("Assertion error")
+ else sys.error("Assertion error")
}
}
else
- error("Assertion error");
+ sys.error("Assertion error");
def arb[a](s: List[a]) =
require (! s.isEmpty) {
View
4 test/files/pos/t0227.scala
@@ -5,7 +5,7 @@ final class Settings {
abstract class Factory {
type libraryType <: Base
- final def apply(settings: Settings): libraryType = error("bla")
+ final def apply(settings: Settings): libraryType = sys.error("bla")
}
abstract class Base {
@@ -19,7 +19,7 @@ class SA(val settings: Settings) extends Base {
SD
) ::: settings.f(
SC
- )
+ )
}
object SC extends Factory {
View
4 test/files/pos/t2331.scala
@@ -4,8 +4,8 @@ trait C {
object Test {
val o /*: C --> no crash*/ = new C {
- def m[T]: Nothing /*: T --> no crash*/ = error("omitted")
+ def m[T]: Nothing /*: T --> no crash*/ = sys.error("omitted")
}
o.m[Nothing]
-}
+}
View
14 test/files/pos/t2421.scala
@@ -1,14 +1,14 @@
object Test {
abstract class <~<[-From, +To] extends (From => To)
- implicit def trivial[A]: A <~< A = error("")
+ implicit def trivial[A]: A <~< A = sys.error("")
trait Forcible[T]
- implicit val forcibleInt: (Int <~< Forcible[Int]) = error("")
+ implicit val forcibleInt: (Int <~< Forcible[Int]) = sys.error("")
- def headProxy[P <: Forcible[Int]](implicit w: Int <~< P): P = error("")
-
- headProxy
- // trivial[Int] should not be considered a valid implicit, since w would have type Int <~< Int,
+ def headProxy[P <: Forcible[Int]](implicit w: Int <~< P): P = sys.error("")
+
+ headProxy
+ // trivial[Int] should not be considered a valid implicit, since w would have type Int <~< Int,
// and headProxy's type parameter P cannot be instantiated to Int
-}
+}
View
10 test/files/pos/t2429.scala
@@ -1,10 +1,10 @@
object Msg {
trait T
-
+
trait TSeq
-
+
object TSeq {
- implicit def fromSeq(s: Seq[T]): TSeq = error("stub")
+ implicit def fromSeq(s: Seq[T]): TSeq = sys.error("stub")
}
def render {
@@ -12,7 +12,7 @@ object Msg {
case (a, b) => {
a match {
case _ => b match {
- case _ => error("stub")
+ case _ => sys.error("stub")
}
}
}
@@ -20,6 +20,6 @@ object Msg {
}
}
object Oops {
- implicit def someImplicit(s: Seq[_]): String = error("stub")
+ implicit def someImplicit(s: Seq[_]): String = sys.error("stub")
def item: String = Nil map { case e: Any => e }
}
View
4 test/files/pos/t2797.scala
@@ -1,9 +1,9 @@
class MyVector[A] {
- def map[B](f: A => B): MyVector[B] = error("")
+ def map[B](f: A => B): MyVector[B] = sys.error("")
}
object Test {
def unzip[B, C](_this: MyVector[(B, C)]): (MyVector[B], MyVector[C]) = {
(_this.map{ bc => bc._1 }, _this.map{ bc => bc._2 })
}
-}
+}
View
10 test/files/pos/t3152.scala
@@ -1,13 +1,13 @@
trait Applicative[M[_]]
sealed trait MA[M[_], A] {
- def sequence[N[_], B](implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = error("stub")
- // def sequence3[N[_], B]()(implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = error("stub")
+ def sequence[N[_], B](implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = sys.error("stub")
+ // def sequence3[N[_], B]()(implicit a: A <:< N[B], n: Applicative[N]): N[M[B]] = sys.error("stub")
}
object test {
- implicit def ListMA[A](l: List[A]): MA[List, A] = error("stub")
- implicit val ao: Applicative[Option] = error("stub")
+ implicit def ListMA[A](l: List[A]): MA[List, A] = sys.error("stub")
+ implicit val ao: Applicative[Option] = sys.error("stub")
/* This compiles OK:
(Nil: List[Option[Int]]).sequence3(): Option[List[Int]]
@@ -17,4 +17,4 @@ object test {
// !!! No line number is reported with the error
(Nil: List[Option[Int]]).sequence: Option[List[Int]]
(List[Option[Int]]()).sequence: Option[List[Int]]
-}
+}
View
6 test/files/pos/t3252.scala
@@ -8,8 +8,8 @@ class A {
}
}
- private def g[T](block : => T) = error("")
+ private def g[T](block : => T) = sys.error("")
}
object B {
- def h(block : => Unit) : Nothing = error("")
-}
+ def h(block : => Unit) : Nothing = sys.error("")
+}
View
4 test/files/pos/t3349/Test.scala
@@ -1,5 +1,5 @@
object Test {
val label = "name"
- val table: Table = error("")
+ val table: Table = sys.error("")
table.addColumn( label, label.getClass )
-}
+}
View
4 test/files/pos/t3363-new.scala
@@ -9,7 +9,7 @@ object TestCase {
//if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine
implicit def map2ops[T,F](fs: Map[T,F]) = new MapOps[F] {
//if you remove this line, then code compiles
- lazy val m: TypeTag[T] = error("just something to make it compile")
+ lazy val m: TypeTag[T] = sys.error("just something to make it compile")
def is(xs: List[T]) = List(xs)
}
@@ -17,4 +17,4 @@ object TestCase {
println(Map(1 -> "2") is List(2))
}
- }
+ }
View
2  test/files/pos/t3363-old.scala
@@ -7,7 +7,7 @@ object TestCase {
//if you inherit from MapOps[T] instead of MapOps[F] then code compiles fine
implicit def map2ops[T,F](fs: Map[T,F]) = new MapOps[F] {
//if you remove this line, then code compiles
- lazy val m: Manifest[T] = error("just something to make it compile")
+ lazy val m: Manifest[T] = sys.error("just something to make it compile")
def is(xs: List[T]) = List(xs)
}
View
10 test/files/pos/t3440.scala
@@ -4,15 +4,15 @@ object test {
}
case object Int8 extends SampleFormat1 {
- def readerFactory = error("")
+ def readerFactory = sys.error("")
}
case object Int16 extends SampleFormat1 {
- def readerFactory = error("")
+ def readerFactory = sys.error("")
}
-
+
(new {}: Any) match {
case 8 => Int8
case 16 => Int16
- case _ => error("")
+ case _ => sys.error("")
}
-}
+}
View
4 test/files/pos/t3477.scala
@@ -1,7 +1,7 @@
class J3 {
- def f[K, K1 >: K, V](x: Map[K1, V]): Map[K, V] = error("")
+ def f[K, K1 >: K, V](x: Map[K1, V]): Map[K, V] = sys.error("")
}
object Test {
(new J3).f(Map[Int, Int]())
-}
+}
View
4 test/files/pos/t3731.scala
@@ -1,8 +1,8 @@
object Test{
trait ZW[S]{type T}
- def ZipWith[S, M <: ZW[S]]: M#T = error("ZW")
+ def ZipWith[S, M <: ZW[S]]: M#T = sys.error("ZW")
- // meh must be parameterised to force an asSeenFrom that
+ // meh must be parameterised to force an asSeenFrom that
// duplicates the refinement in the TR's pre without updating its sym
def meh[A] = ZipWith[A, ZW[A]{type T=Stream[A]}]
View
8 test/files/pos/t3883.scala
@@ -1,14 +1,14 @@
// need to test both orders
object A1 {
- implicit def i: Equiv[Boolean] = error("")
- implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = error("")
+ implicit def i: Equiv[Boolean] = sys.error("")
+ implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = sys.error("")
implicitly[Equiv[Boolean]]
}
object A2 {
- implicit def div[T, A](implicit f: T => A, eq: Equiv[A]): Equiv[T] = error("")
- implicit def i: Equiv[Boolean] = error("")
+ implicit def div[T, A](implicit f: T => A, eq: