Closed
Description
When a given instance is generated by a macro and the macro fails, it would be useful to see which errors were generated in expansion, rather than only see the method that was attempted.
Minimized code
class FailHere
trait TC[T]
object TC {
inline def mkDefaultTC[A]: TC[A] = inline compiletime.erasedValue[A] match {
case _: FailHere => compiletime.error("blow up here")
case _ => ???
}
inline given [T]: TC[T] = mkDefaultTC[T]
}
def test =
summon[TC[Int]] // ok
summon[TC[FailHere]] // error: no implicit argument of type TC[FailHere] was found
TC.mkDefaultTC[FailHere] // error: blow up here
Output
-- Error: sandbox/mirror/example.scala:16:22 -----------------------------------
16 | summon[TC[FailHere]] // error: no implicit argument of type TC[FailHere] was found
| ^
|no implicit argument of type TC[FailHere] was found for parameter x of method summon in object Predef.
|I found:
|
| TC.given_TC_T[FailHere]
|
|But method given_TC_T in object TC does not match type TC[FailHere].
-- Error: sandbox/mirror/example.scala:17:16 -----------------------------------
17 | TC.mkDefaultTC[FailHere] // error: blow up here
| ^^^^^^^^^^^^^^^^^^^^^^^^
| blow up here
2 errors found
Expectation
I would also like to see the "blow up here" error for summon[TC[FailHere]]
, for example, we already see that given_TC_T
was attempted so maybe the error can say that But method given_TC_T failed with errors: ...