Skip to content

Commit 320ca51

Browse files
committed
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.
1 parent f320ac8 commit 320ca51

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
15291529
}
15301530
def issueErrors() = {
15311531
for (err <- errors) ctx.error(err(), tree.pos.endPos)
1532-
tree
1532+
tree.withType(wtp.resultType)
15331533
}
15341534
val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) =>
15351535
def where = d"parameter $pname of $methodStr"

tests/neg/subtyping.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class A extends B
66
object Test {
77
def test1(): Unit = {
88
implicitly[B#X <:< A#X] // error: no implicit argument
9-
} // error: no implicit argument
9+
}
1010
def test2(): Unit = {
1111
val a : { type T; type U } = ??? // error // error
1212
implicitly[a.T <:< a.U] // error: no implicit argument

0 commit comments

Comments
 (0)