1
1
/* NSC -- new Scala compiler
2
* Copyright 2002-2011 LAMP/EPFL
2
* Copyright 2002-2013 LAMP/EPFL
3
3
* @author Martin Odersky
6
6
package scala.tools.nsc
9
import scala.tools.nsc.util._
10
import scala.tools.util.StringOps
9
import scala.reflect.internal.util._
10
import scala.reflect.internal.util.StringOps._
14
13
* This interface provides methods to issue information, warning and
21
20
class Severity(val id: Int) extends severity.Value {
24
val INFO = new Severity(0)
25
val WARNING = new Severity(1)
26
val ERROR = new Severity(2)
23
val INFO = new Severity(0) {
24
override def toString: String = "INFO"
26
val WARNING = new Severity(1) {
27
override def toString: String = "WARNING"
29
val ERROR = new Severity(2) {
30
override def toString: String = "ERROR"
28
33
/** Whether very long lines can be truncated. This exists so important
29
34
* debugging information (like printing the classpath) is not rendered
47
52
finally incompleteHandler = saved
51
def hasErrors = ERROR.count > 0 || cancelled
52
def hasWarnings = WARNING.count > 0
54
def info(pos: Position, msg: String, force: Boolean) { info0(pos, msg, INFO, force) }
55
def warning(pos: Position, msg: String ) { info0(pos, msg, WARNING, false) }
56
def error(pos: Position, msg: String ) { info0(pos, msg, ERROR, false) }
57
def incompleteInputError(pos: Position, msg: String ) {
56
def hasErrors = ERROR.count > 0 || cancelled
57
def hasWarnings = WARNING.count > 0
59
/** For sending a message which should not be labeled as a warning/error,
60
* but also shouldn't require -verbose to be visible.
62
def echo(msg: String): Unit = info(NoPosition, msg, true)
63
def echo(pos: Position, msg: String): Unit = info(pos, msg, true)
65
/** Informational messages, suppressed unless -verbose or force=true. */
66
def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force)
68
/** Warnings and errors. */
69
def warning(pos: Position, msg: String): Unit = withoutTruncating(info0(pos, msg, WARNING, false))
70
def error(pos: Position, msg: String): Unit = withoutTruncating(info0(pos, msg, ERROR, false))
71
def incompleteInputError(pos: Position, msg: String): Unit = {
58
72
if (incompleteHandled) incompleteHandler(pos, msg)
59
73
else error(pos, msg)
72
@deprecated("Moved to scala.tools.util.StringOps", "2.10.0")
86
@deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0")
73
87
def countElementsAsString(n: Int, elements: String): String = StringOps.countElementsAsString(n, elements)
74
@deprecated("Moved to scala.tools.util.StringOps", "2.10.0")
88
@deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0")
75
89
def countAsString(n: Int): String = StringOps.countAsString(n)