Skip to content

Instantly share code, notes, and snippets.

@choplin
Last active February 15, 2020 17:15
Show Gist options
  • Save choplin/79d0fddbb6c0da9f2121f43c6796c473 to your computer and use it in GitHub Desktop.
Save choplin/79d0fddbb6c0da9f2121f43c6796c473 to your computer and use it in GitHub Desktop.
import mill._, scalalib._
object example extends ScalaModule {
def scalaVersion = "2.13.1"
def ivyDeps = Agg[Dep](
ivy"org.wvlet.airframe::airframe:20.2.0"
)
}
❯ ./mill example.run
[27/37] example.compile
[info] Compiling 1 Scala source to /home/okuno/study/scala/airframe/out/example/compile/dest/classes ...
[error] /home/okuno/study/scala/airframe/example/src/Service.scala:6:17: illegal inheritance from sealed trait Adt
[error] val adt = bind[Adt]
[error] ^
[error] one error found
1 targets failed
example.compile Compilation failed
package example
import wvlet.airframe._
sealed trait Adt
object Adt {
object Foo extends Adt
object Bar extends Adt
}
object Main extends App {
val design = Design.newDesign.bind[Adt].toInstance(Adt.Foo)
design.build[Adt](adt => println(adt))
}
package example
import wvlet.airframe._
// Does not compile
// trait Service {
// val adt = bind[Adt]
//}
// ok
class Service (adt: Adt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment