lihaoyi / autowire

Macros for simple/safe RPCs between Scala applications, including ScalaJS/ScalaJVM
378 stars 48 forks source link

Compilation fails in Scala 2.12.8 if one or more parameters have default values defined in the API trait #78

Open rpiaggio opened 5 years ago

rpiaggio commented 5 years ago

Example:

trait SomeEntityApi {
  def retrieve(limit: Option[Int], skip: Int): Future[Seq[Entity]]
}

works, while:

trait SomeEntityApi {
  def retrieve(limit: Option[Int] = None, skip: Int = 0): Future[Seq[Entity]]
}

fails with:

[warn] an unexpected type representation reached the compiler backend while compiling Application.scala: <error>. If possible, please file a bug on https://github.com/scala/bug/issues.
[error] Error while emitting Application.scala
[error] <error> (of class scala.reflect.internal.Types$ErrorType$)
[error] Error while emitting Application.scala
[error] assertion failed: ClassBType.info not yet assigned: Lcontrollers/Application$$anonfun$1;
[warn] one warning found
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed

Note 1: What actually fails is the compilation of Router.route[EventApi](new EventService) (present in Application.scala in this case).

Note 2: Worked with Scala 2.12.6.

Thank you!

nafg commented 5 years ago

I'm getting a similar error, except it persists even after I eliminated defaults:

[warn] an unexpected type representation reached the compiler backend while compiling AutowireServerLayer.scala: <error>. If possible, please file a bug on https://github.com/scala/bug/issues.
[error] Error while emitting AutowireServerLayer.scala
[error] <error> (of class scala.reflect.internal.Types$ErrorType$)
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer;
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer$AutowireServer$;
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer$AutowireServer$$anonfun$routes$1;
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer$AutowireServer$;
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer$AutowireServer$;
[error] Error while emitting AutowireServerLayer.scala
[error] assertion failed: ClassBType.info not yet assigned: Llrbcol/snippet/request/AutowireServerLayer;
urwithsumit commented 11 months ago

Hi, I am having the same issue. How were you able to work around on this issue?

thanks.

Ahnfelt commented 8 months ago

We get the same error on Scala 2.12.19. We can also reproduce the error on 2.12.8 but not on 2.12.7.