-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
This is a short code snippet that demonstrates the problem:
import singleton.ops.RequireMsg
object RequireMsgSpike {
trait HasM {
type M = Int
}
trait Foo {
trait FF[T]
}
object Foo3 extends Foo {
implicit def ev3[T <: HasM](
implicit
r: RequireMsg[false, "Just Bad Type"]
): Set[FF[T]] = ???
}
object Foo4 extends Foo {
implicit def ev4[T <: HasM](
implicit
r: Int
): Set[FF[T]] = ???
}
implicitly[Set[Foo3.FF[HasM]]]
implicitly[Set[Foo4.FF[HasM]]]
}
error message:
[Error] /***/RequireMsgSpike.scala:34:13: Just Bad Type
[Error] /***/RequireMsgSpike.scala:35:13: Just Bad Type
The second implicit error message got corrupted by the first.
if you delete the first implicit line implicitly[Set[Foo3.FF[HasM]]]
, the error message goes back to normal:
[Error] /home/peng/git/shapesafe/core/src/test/scala/shapesafe/core/debugging/RequireMsgSpike.scala:35:13: could not find implicit value for parameter e: Set[shapesafe.core.debugging.RequireMsgSpike.Foo4.FF[shapesafe.core.debugging.RequireMsgSpike.HasM]] (No implicit view available from shapesafe.core.debugging.RequireMsgSpike.Foo4.FF[shapesafe.core.debugging.RequireMsgSpike.HasM] => Boolean.)
I vaguely remember that RequireMsg macro overwrites @ImplicitNotFound annotation to achieve its purpose, and this implementation is derived from shapeless. So I guess the easiest way for me is to try the following solution:
- try to reproduce it in shapeless
- if succeed, forward-port it to singleton-ops
- otherwise, file the same issue for shapeless, and try to write an original fix or circumvention
Metadata
Metadata
Assignees
Labels
No labels