diff options
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Diagnostic.scala')
-rw-r--r-- | src/dotty/tools/dotc/reporting/Diagnostic.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/reporting/Diagnostic.scala b/src/dotty/tools/dotc/reporting/Diagnostic.scala index ea3ea4112..bcf55e993 100644 --- a/src/dotty/tools/dotc/reporting/Diagnostic.scala +++ b/src/dotty/tools/dotc/reporting/Diagnostic.scala @@ -4,22 +4,22 @@ package reporting import util.SourcePosition -object Diagnostic { - - // Error levels - val ERROR = 2 - val WARNING = 1 - val INFO = 0 +import java.util.Optional +object Diagnostic { val nonSensicalStartTag = "<nonsensical>" val nonSensicalEndTag = "</nonsensical>" } -class Diagnostic(msgFn: => String, val pos: SourcePosition, val level: Int) extends Exception { +class Diagnostic(msgFn: => String, val pos: SourcePosition, val level: Int) + extends Exception with interfaces.Diagnostic { import Diagnostic._ private var myMsg: String = null private var myIsNonSensical: Boolean = false + override def position: Optional[interfaces.SourcePosition] = + if (pos.exists && pos.source.exists) Optional.of(pos) else Optional.empty() + /** The message to report */ def message: String = { if (myMsg == null) { |