-
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.
[Issue 15987] Nicer error message in case a
derived
method has an e…
…xplicit term param (#21332)
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 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,5 @@ | ||
-- Error: tests/neg/i15987.scala:26:40 --------------------------------------------------------------------------------- | ||
26 |case class Person(name: String) derives ShowWithExplicit, // error | ||
| ^ | ||
| derived instance ShowWithExplicit[Person] failed to generate: | ||
| method `derived` from object ShowWithExplicit takes explicit term parameters |
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,30 @@ | ||
trait ShowWithExplicit[A] | ||
|
||
object ShowWithExplicit: | ||
def derived[A, B](explicit: String)(using DummyImplicit)(implicit dummy: DummyImplicit): ShowWithExplicit[A] = ??? | ||
|
||
trait ShowUsingAndImplicit[A] | ||
|
||
object ShowUsingAndImplicit: | ||
def derived[A, B](using DummyImplicit)(implicit dummy: DummyImplicit): ShowUsingAndImplicit[A] = ??? | ||
|
||
trait ShowUsing[A] | ||
|
||
object ShowUsing: | ||
def derived[A](using DummyImplicit): ShowUsing[A] = ??? | ||
|
||
trait ShowImplicit[A] | ||
|
||
object ShowImplicit: | ||
def derived[A](implicit ev: DummyImplicit): ShowImplicit[A] = ??? | ||
|
||
trait ShowContra[-A] | ||
|
||
object ShowContra: | ||
val derived: ShowContra[Any] = ??? | ||
|
||
case class Person(name: String) derives ShowWithExplicit, // error | ||
ShowUsingAndImplicit, | ||
ShowUsing, | ||
ShowImplicit, | ||
ShowContra |