-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #10098: Handle inheritance for implicitNotFound annotation
- Loading branch information
Showing
4 changed files
with
50 additions
and
6 deletions.
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,16 @@ | ||
-- Error: tests/neg/i10098.scala:20:32 --------------------------------------------------------------------------------- | ||
20 | implicitly[Bar12[Int, String]] // error | ||
| ^ | ||
| There's no Foo2[String, Int] | ||
-- Error: tests/neg/i10098.scala:21:32 --------------------------------------------------------------------------------- | ||
21 | implicitly[Bar21[Int, String]] // error | ||
| ^ | ||
| There's no Foo1[String, Int] | ||
-- Error: tests/neg/i10098.scala:22:32 --------------------------------------------------------------------------------- | ||
22 | implicitly[Baz12[Int, String]] // error | ||
| ^ | ||
| There's no Baz12[Int, String] | ||
-- Error: tests/neg/i10098.scala:23:32 --------------------------------------------------------------------------------- | ||
23 | implicitly[Baz21[Int, String]] // error | ||
| ^ | ||
| There's no Baz21[Int, String] |
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,24 @@ | ||
import annotation.implicitNotFound | ||
|
||
@implicitNotFound("There's no Foo1[${A}, ${B}]") | ||
trait Foo1[A, B] | ||
|
||
@implicitNotFound("There's no Foo2[${A}, ${B}]") | ||
trait Foo2[A, B] | ||
|
||
trait Bar12[C, D] extends Foo1[D, C] with Foo2[D, C] | ||
|
||
trait Bar21[C, D] extends Foo2[D, C] with Foo1[D, C] | ||
|
||
@implicitNotFound("There's no Baz12[${C}, ${D}]") | ||
trait Baz12[C, D] extends Foo1[D, C] with Foo2[D, C] | ||
|
||
@implicitNotFound("There's no Baz21[${C}, ${D}]") | ||
trait Baz21[C, D] extends Foo2[D, C] with Foo1[D, C] | ||
|
||
object Test { | ||
implicitly[Bar12[Int, String]] // error | ||
implicitly[Bar21[Int, String]] // error | ||
implicitly[Baz12[Int, String]] // error | ||
implicitly[Baz21[Int, String]] // 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