aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/SymDenotations.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/SymDenotations.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/SymDenotations.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/SymDenotations.scala11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index e2bb0ac1a..aaae78c57 100644
--- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1937,12 +1937,12 @@ object SymDenotations {
/** A completer for missing references */
class StubInfo() extends LazyType {
- def initializeToDefaults(denot: SymDenotation)(implicit ctx: Context) = {
+ def initializeToDefaults(denot: SymDenotation, errMsg: => String)(implicit ctx: Context) = {
denot.info = denot match {
case denot: ClassDenotation =>
ClassInfo(denot.owner.thisType, denot.classSymbol, Nil, EmptyScope)
case _ =>
- ErrorType
+ new ErrorType(errMsg)
}
denot.privateWithin = NoSymbol
}
@@ -1954,13 +1954,14 @@ object SymDenotations {
if (file != null) (s" in $file", file.toString)
else ("", "the signature")
val name = ctx.fresh.setSetting(ctx.settings.debugNames, true).nameString(denot.name)
- ctx.error(
+ def errMsg =
i"""bad symbolic reference. A signature$location
|refers to $name in ${denot.owner.showKind} ${denot.owner.showFullName} which is not available.
|It may be completely missing from the current classpath, or the version on
- |the classpath might be incompatible with the version used when compiling $src.""")
+ |the classpath might be incompatible with the version used when compiling $src."""
+ ctx.error(errMsg)
if (ctx.debug) throw new Error()
- initializeToDefaults(denot)
+ initializeToDefaults(denot, errMsg)
}
}