トレイト: UserAccountRepository[M[_]] https://github.com/j5ik2o/scala-ddd-base/blob/master/example/src/main/scala/com/github/j5ik2o/dddbase/example/repository/UserAccountRepository.scala
実装: UserAccountRepositoryBySkinny https://github.com/j5ik2o/scala-ddd-base/blob/master/example/src/main/scala/com/github/j5ik2o/dddbase/example/repository/skinny/UserAccountRepositoryBySkinny.scala
があったとして、以下のようなDIをさせたいのですが、
val design = newDesign.bind[UserAccountRepository[BySkinny]].toInstance(UserAccountRepository.bySkinny)
以下のようなエラーが発生します。サポート外ですかね? けっこうScalaならではの使い方なのでサポートしてくれると、他のコンテナより優位かもですが…階数とか考えるとめんどいですかね…。
An exception or error caused a run to abort: Surface com.github.j5ik2o.dddbase.example.repository.UserAccountRepository.BySkinny is not found in cache
java.lang.IllegalArgumentException: Surface com.github.j5ik2o.dddbase.example.repository.UserAccountRepository.BySkinny is not found in cache
at wvlet.surface.reflect.SurfaceFactory$$anonfun$get$1.apply(SurfaceFactory.scala:53)
at wvlet.surface.reflect.SurfaceFactory$$anonfun$get$1.apply(SurfaceFactory.scala:53)
at scala.collection.MapLike$class.getOrElse(MapLike.scala:128)
at scala.collection.AbstractMap.getOrElse(Map.scala:59)
at wvlet.surface.reflect.SurfaceFactory$.get(SurfaceFactory.scala:53)
at wvlet.surface.package$.getCached(package.scala:28)
at wvlet.surface.LazySurface.ref(Surfaces.scala:206)
at wvlet.surface.LazySurface.params(Surfaces.scala:217)
Airframe handles type aliases (BySkinny[A]) and de-aliased types (UserAccountRepository[BySkinny]) differently, so this code should be written like:
For example, in a simple example, using higher kind types has no problem:
https://github.com/wvlet/airframe/blob/ada217700274c88ab7bddde43f678483c71ff393/airframe/src/test/scala/wvlet/airframe/HigherKindTypeTest.scala
It seems this error is happening when traversing recursive types. I guess when traversing type aliases, Airframe should traverse de-aliased types as well.