-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Turn mismatch given errors into given not found errors #8611
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
smarter
merged 1 commit into
scala:master
from
scalacenter:replace-implicit-mismatch-with-implicit-not-found
Apr 6, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Error: tests/neg/implicitSearch.scala:13:12 ------------------------------------------------------------------------- | ||
13 | sort(xs) // error (with a partially constructed implicit argument shown) | ||
| ^ | ||
| no implicit argument of type Test.Ord[List[List[T]]] was found for parameter o of method sort in object Test. | ||
| I found: | ||
| | ||
| Test.listOrd[T](Test.listOrd[T](/* missing */implicitly[Test.Ord[T]])) | ||
| | ||
| But no implicit values were found that match type Test.Ord[T]. | ||
-- Error: tests/neg/implicitSearch.scala:15:38 ------------------------------------------------------------------------- | ||
15 | listOrd(listOrd(implicitly[Ord[T]] /*not found*/)) // error | ||
| ^ | ||
| no implicit argument of type Test.Ord[T] was found for parameter ev of method implicitly in object DottyPredef |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Error: tests/neg/missing-implicit3.scala:13:36 ---------------------------------------------------------------------- | ||
13 |val sortedFoos = sort(List(new Foo)) // error | ||
| ^ | ||
|no implicit argument of type ord.Ord[ord.Foo] was found for an implicit parameter of method sort in package ord. | ||
|I found: | ||
| | ||
| ord.Ord.ordered[A](/* missing */implicitly[ord.Foo => Comparable[? >: ord.Foo]]) | ||
| | ||
|But no implicit values were found that match type ord.Foo => Comparable[? >: ord.Foo]. | ||
| | ||
|The following import might make progress towards fixing the problem: | ||
| | ||
| import ord.Ord.ordered | ||
| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ord | ||
|
||
trait Ord[A] | ||
|
||
object Ord { | ||
given ordered[A](using A => java.lang.Comparable[? >: A]) as Ord[A] = ??? | ||
} | ||
|
||
def sort[A: Ord](as: List[A]): List[A] = ??? | ||
|
||
class Foo | ||
|
||
val sortedFoos = sort(List(new Foo)) // error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
-- Error: tests/neg/subtyping.scala:8:27 ------------------------------------------------------------------------------- | ||
8 | implicitly[B#X <:< A#X] // error: no implicit argument | ||
| ^ | ||
| Cannot prove that B#X <:< A#X.. | ||
| I found: | ||
| | ||
| <:<.refl[Nothing] | ||
| | ||
| But method refl in object <:< does not match type B#X <:< A#X. | ||
| Cannot prove that B#X <:< A#X. | ||
-- Error: tests/neg/subtyping.scala:12:27 ------------------------------------------------------------------------------ | ||
12 | implicitly[a.T <:< a.U] // error: no implicit argument | ||
| ^ | ||
| Cannot prove that a.T <:< a.U.. | ||
| I found: | ||
| | ||
| <:<.refl[Nothing] | ||
| | ||
| But method refl in object <:< does not match type a.T <:< a.U. | ||
| Cannot prove that a.T <:< a.U. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Error: tests/neg/summon-function.scala:2:23 ------------------------------------------------------------------------- | ||
2 | summon[Int => String] // error | ||
| ^ | ||
| No implicit view available from Int => String. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
object Test { | ||
summon[Int => String] // error | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there are (and there were) no tests to exercise this code path.