forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest imports for the expected type of the underlying implicit not …
…found error We used to suggest imports for the outermost type of a chain of implicits. Now, we suggest imports for the `expectedType` of the underlying `NoMatchingImplicits`. Fixes scala#8827
- Loading branch information
Showing
6 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 @@ | ||
-- [E172] Type Error: tests/neg/i8827a.scala:16:26 --------------------------------------------------------------------- | ||
16 | summon[Order[List[Foo]]] // error | ||
| ^ | ||
| No given instance of type pkg.Order[List[pkg.Foo]] was found for parameter x of method summon in object Predef. | ||
| I found: | ||
| | ||
| pkg.Order.orderList[pkg.Foo](/* missing */summon[pkg.Order[pkg.Foo]]) | ||
| | ||
| But no implicit values were found that match type pkg.Order[pkg.Foo]. | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import pkg.Implicits.orderFoo | ||
| |
This file contains 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,16 @@ | ||
package pkg | ||
|
||
trait Order[A] | ||
|
||
object Order { | ||
implicit def orderList[A](implicit orderA: Order[A]): Order[List[A]] = ??? | ||
} | ||
|
||
class Foo | ||
|
||
object Implicits { | ||
implicit def orderFoo: Order[Foo] = ??? | ||
} | ||
|
||
@main def main: Unit = | ||
summon[Order[List[Foo]]] // error |
This file contains 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 @@ | ||
-- [E172] Type Error: tests/neg/i8827b.scala:16:28 --------------------------------------------------------------------- | ||
16 | summon[Order[Option[Foo]]] // error | ||
| ^ | ||
|No given instance of type pkg.Order[Option[pkg.Foo]] was found for parameter x of method summon in object Predef. | ||
|I found: | ||
| | ||
| pkg.Order.given_Order_Option[pkg.Foo](/* missing */summon[pkg.Order[pkg.Foo]]) | ||
| | ||
|But no implicit values were found that match type pkg.Order[pkg.Foo]. | ||
| | ||
|The following import might fix the problem: | ||
| | ||
| import pkg.Givens.orderFoo | ||
| |
This file contains 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,16 @@ | ||
package pkg | ||
|
||
trait Order[A] | ||
|
||
object Order { | ||
given [A](using orderA: Order[A]): Order[Option[A]] = ??? | ||
} | ||
|
||
class Foo | ||
|
||
object Givens { | ||
given orderFoo: Order[Foo] = ??? | ||
} | ||
|
||
@main def main: Unit = | ||
summon[Order[Option[Foo]]] // error |
This file contains 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