macwire
macwire copied to clipboard
Feature request: wiring abstract classes and traits
The following does not compile:
object Foo {
trait Dep
abstract class Abs {
def foo: Dep
}
trait T {
def bar: Dep
}
val d: Dep = new Dep {}
val a: Abs = wire[Abs]
val t: T = wire[T]
def main(args: Array[String]): Unit =
println(s"a.foo ${a.foo}")
}
MacWire says
Error: class Abs is abstract; cannot be instantiated
val a: Abs = wire[Abs]
Error: Cannot find a public constructor nor a companion object for [Foo.T]
val t: T = wire[T]
It would be nice if macwire could wire abstract classes and traits when it can satisfy abstract members like it does for constructor args.