summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-27 01:58:46 +0000
committerPaul Phillips <paulp@improving.org>2010-10-27 01:58:46 +0000
commit0e3e701870e705a453df5f4e178af377eeb54aec (patch)
tree0ab1e63acd6eb4c1893e2a98223e154e41ccf730 /src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
parenta15e48df88fde5172526f68939530862f72f19ca (diff)
downloadscala-0e3e701870e705a453df5f4e178af377eeb54aec.tar.gz
scala-0e3e701870e705a453df5f4e178af377eeb54aec.tar.bz2
scala-0e3e701870e705a453df5f4e178af377eeb54aec.zip
Some uninteresting code related to error messag...
Some uninteresting code related to error messages, which I'm checking in mostly because I booted the r23379 commit in a git-svn meltdown and posterity demands the message, which was: You can now use the self-type of an anonymous class as a singleton type in a pattern match ON THE MOON. Actual test case excerpt: val x4 = new { self => def f(x: Any) = x match { case _: x1.type => 1 case _: x2.type => 2 case _: x3.type => 3 case _: self.type => 4 case x: Dingus.type => x.IamDingus } } Closes #576, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
index be576289f6..d5bb546b7f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
@@ -39,6 +39,8 @@ trait TypeDiagnostics {
import definitions._
import global.typer.infer
+ private def currentUnit = currentRun.currentUnit
+
/** It can be quite difficult to know which of the many functions called "error"
* is being called at any given point in the compiler. To alleviate this I am
* renaming such functions inside this trait based on where it originated.
@@ -53,6 +55,14 @@ trait TypeDiagnostics {
def noErroneousSyms(syms: Symbol*) = syms forall (x => !x.isErroneous)
def noErroneousTrees(trees: Tree*) = trees forall (x => !x.isErroneous)
+ /** For errors which are artifacts of the implementation: such messages
+ * indicate that the restriction may be lifted in the future.
+ */
+ def restrictionWarning(pos: Position, unit: CompilationUnit, msg: String): Unit =
+ unit.warning(pos, "Implementation restriction: " + msg)
+ def restrictionError(pos: Position, unit: CompilationUnit, msg: String): Unit =
+ unit.error(pos, "Implementation restriction: " + msg)
+
/** A map of Positions to addendums - if an error involves a position in
* the map, the addendum should also be printed.
*/