aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Symbols.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-17 15:09:27 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-17 15:09:52 +0100
commitb63480a59bbdd284a5e32281fbb0037e509f4b1e (patch)
tree825824024ad6768646c3dbf630a2db9283eedcd4 /compiler/src/dotty/tools/dotc/core/Symbols.scala
parent653698ef67a5cf8f5e0fd0fcdcd1f631f1dc96e2 (diff)
downloaddotty-b63480a59bbdd284a5e32281fbb0037e509f4b1e.tar.gz
dotty-b63480a59bbdd284a5e32281fbb0037e509f4b1e.tar.bz2
dotty-b63480a59bbdd284a5e32281fbb0037e509f4b1e.zip
Make errors are not swept under the carpet
Typer#ensureReported's comment outlines an example where errors could go unreported, resulting in error trees after typer without any reported error messages. This commit makes sure that at least one error is reported if a tree node has an error type. Fixes #1802.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Symbols.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Symbols.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala
index cfd85c49c..b10b94ad8 100644
--- a/compiler/src/dotty/tools/dotc/core/Symbols.scala
+++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala
@@ -22,6 +22,7 @@ import NameOps._
import ast.tpd.Tree
import ast.TreeTypeMap
import Constants.Constant
+import reporting.diagnostic.Message
import Denotations.{ Denotation, SingleDenotation, MultiDenotation }
import collection.mutable
import io.AbstractFile
@@ -290,9 +291,11 @@ trait Symbols { this: Context =>
*/
def newSkolem(tp: Type) = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | Permanent, tp)
- def newErrorSymbol(owner: Symbol, name: Name) =
+ def newErrorSymbol(owner: Symbol, name: Name, msg: => Message) = {
+ val errType = new ErrorType(msg)
newSymbol(owner, name, SyntheticArtifact,
- if (name.isTypeName) TypeAlias(ErrorType) else ErrorType)
+ if (name.isTypeName) TypeAlias(errType) else errType)
+ }
/** Map given symbols, subjecting their attributes to the mappings
* defined in the given TreeTypeMap `ttmap`.