aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-01-31 22:22:54 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-09 09:43:06 +0100
commite87dee212351aa7acb15760814cdd1c30c4de019 (patch)
tree1833586a82cee7632c150c35d5ec41f0187d80bb
parent0480cb2a5902b733145f54fdc238aba7b831396b (diff)
downloaddotty-e87dee212351aa7acb15760814cdd1c30c4de019.tar.gz
dotty-e87dee212351aa7acb15760814cdd1c30c4de019.tar.bz2
dotty-e87dee212351aa7acb15760814cdd1c30c4de019.zip
Fix path error disgnastics
Fix wording so that it works for nested errors as well. Incorparte Tiark's latest example.
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala11
-rw-r--r--src/dotty/tools/dotc/typer/Checking.scala2
-rw-r--r--test/dotc/tests.scala2
-rw-r--r--tests/neg/i1050.scala16
4 files changed, 23 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 9fcc6abbc..882ab9f10 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -674,7 +674,6 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
if (scala2Mode) migrationWarning(msg, pos)
scala2Mode
}
-
}
object TypeOps {
@@ -687,16 +686,16 @@ object TypeOps {
object Realizable extends Realizability("")
- object NotConcrete extends Realizability("it is not a concrete type")
+ object NotConcrete extends Realizability(" is not a concrete type")
- object NotStable extends Realizability("it is not a stable reference")
+ object NotStable extends Realizability(" is not a stable reference")
class NotFinal(sym: Symbol)(implicit ctx: Context)
- extends Realizability(i"it refers to nonfinal $sym")
+ extends Realizability(i" refers to nonfinal $sym")
class HasProblemBounds(mbr: SingleDenotation)(implicit ctx: Context)
- extends Realizability(i"it has a member $mbr with possibly conflicting bounds ${mbr.info.bounds.lo} <: ... <: ${mbr.info.bounds.hi}")
+ extends Realizability(i" has a member $mbr with possibly conflicting bounds ${mbr.info.bounds.lo} <: ... <: ${mbr.info.bounds.hi}")
class ProblemInUnderlying(tp: Type, problem: Realizability)(implicit ctx: Context)
- extends Realizability(i"its underlying type ${tp} ${problem.msg}")
+ extends Realizability(i"s underlying type ${tp}${problem.msg}")
}
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala
index ee1c2a061..ca7c5c5ab 100644
--- a/src/dotty/tools/dotc/typer/Checking.scala
+++ b/src/dotty/tools/dotc/typer/Checking.scala
@@ -325,7 +325,7 @@ trait Checking {
def checkRealizable(tp: Type, pos: Position)(implicit ctx: Context): Unit = {
val rstatus = ctx.realizability(tp)
if (rstatus ne TypeOps.Realizable) {
- def msg = d"$tp is not a legal path since ${rstatus.msg}"
+ def msg = d"$tp is not a legal path since it${rstatus.msg}"
if (ctx.scala2Mode) ctx.migrationWarning(msg, pos) else ctx.error(msg, pos)
}
}
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 689f92b04..81fc277fa 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -162,7 +162,7 @@ class tests extends CompilerTest {
@Test def neg_i803 = compileFile(negDir, "i803", xerrors = 2)
@Test def neg_i866 = compileFile(negDir, "i866", xerrors = 2)
@Test def neg_i974 = compileFile(negDir, "i974", xerrors = 2)
- @Test def neg_i1050 = compileFile(negDir, "i1050", xerrors = 5)
+ @Test def neg_i1050 = compileFile(negDir, "i1050", xerrors = 6)
@Test def neg_i1050a = compileFile(negDir, "i1050a", xerrors = 2)
@Test def neg_moduleSubtyping = compileFile(negDir, "moduleSubtyping", xerrors = 4)
@Test def neg_escapingRefs = compileFile(negDir, "escapingRefs", xerrors = 2)
diff --git a/tests/neg/i1050.scala b/tests/neg/i1050.scala
index 99d81c317..047d9f776 100644
--- a/tests/neg/i1050.scala
+++ b/tests/neg/i1050.scala
@@ -63,6 +63,22 @@ object Tiark2 {
val v = new V {}
v.brand("boom!"): Nothing
}
+object Tiark3 {
+ trait A { type L <: Nothing }
+ trait B { type L >: Any}
+ trait U {
+ type X <: B
+ def p2: X
+ final lazy val p: X = p2
+ def brand(x: Any): p.L = x
+ }
+ trait V extends U {
+ type X = B with A
+ def p2: X = ???
+ }
+ val v = new V {}
+ v.brand("boom!"): Nothing
+}
/*
object Import {
trait A { type L <: Nothing }