Skip to content

Reject incomplete implicit dictionaries #6798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,7 @@ final class SearchRoot extends SearchHistory {
val pruned = prune(List(tree), implicitDictionary.map(_._2).toList, Nil)
implicitDictionary0 = null
if (pruned.isEmpty) result
else if (pruned.exists(_._2 == EmptyTree)) NoMatchingImplicitsFailure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to provide a more detailed error that would let the user know more about how the search failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle I guess so. But it's not obvious (to me) how to do that.

else {
// If there are any dictionary entries remaining after pruning, construct a dictionary
// class of the form,
Expand Down
10 changes: 10 additions & 0 deletions tests/neg/i6796.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
object Test {
class A
class B

implicit def mkA(implicit b: => B): A = ???
implicit def mkB(implicit a: A, i: Int): B = ???

implicitly[A] // error
}