aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-21 15:40:58 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-21 15:40:58 +0200
commit320ca51f0226cf61dfa6d882d30de15ab221f07b (patch)
tree15467f3d2070fb976133cd2da459be9d590295c7
parentf320ac848ae418b0ed9a1870c0afd7b6420d31c1 (diff)
downloaddotty-320ca51f0226cf61dfa6d882d30de15ab221f07b.tar.gz
dotty-320ca51f0226cf61dfa6d882d30de15ab221f07b.tar.bz2
dotty-320ca51f0226cf61dfa6d882d30de15ab221f07b.zip
Avoid propagating unresolved implicits
When an implicit argument is not found, we should in any case assume the result type of the implicit method as the type of the tree (after reporting an error, of course). If we don't do that, we get implicit errors on weird positions when we try to find an implicit argument for the same tree again. This caused a spurious error in subtyping.scala, and also caused an additional error at the end of EqualityStrawman1.scala.
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala2
-rw-r--r--tests/neg/subtyping.scala2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 53296f9c9..b95acc7ca 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1529,7 +1529,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def issueErrors() = {
for (err <- errors) ctx.error(err(), tree.pos.endPos)
- tree
+ tree.withType(wtp.resultType)
}
val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) =>
def where = d"parameter $pname of $methodStr"
diff --git a/tests/neg/subtyping.scala b/tests/neg/subtyping.scala
index ff3c7a519..27cc0568e 100644
--- a/tests/neg/subtyping.scala
+++ b/tests/neg/subtyping.scala
@@ -6,7 +6,7 @@ class A extends B
object Test {
def test1(): Unit = {
implicitly[B#X <:< A#X] // error: no implicit argument
- } // error: no implicit argument
+ }
def test2(): Unit = {
val a : { type T; type U } = ??? // error // error
implicitly[a.T <:< a.U] // error: no implicit argument