Skip to content

Commit e0962b3

Browse files
authored
Merge pull request #6798 from milessabin/topic/i6796
Reject incomplete implicit dictionaries
2 parents ea57e36 + d829950 commit e0962b3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,7 @@ final class SearchRoot extends SearchHistory {
18421842
val pruned = prune(List(tree), implicitDictionary.map(_._2).toList, Nil)
18431843
implicitDictionary0 = null
18441844
if (pruned.isEmpty) result
1845+
else if (pruned.exists(_._2 == EmptyTree)) NoMatchingImplicitsFailure
18451846
else {
18461847
// If there are any dictionary entries remaining after pruning, construct a dictionary
18471848
// class of the form,

tests/neg/i6796.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
object Test {
2+
class A
3+
class B
4+
5+
implicit def mkA(implicit b: => B): A = ???
6+
implicit def mkB(implicit a: A, i: Int): B = ???
7+
8+
implicitly[A] // error
9+
}
10+

0 commit comments

Comments
 (0)