diff options
Diffstat (limited to 'main/core/src/define')
-rw-r--r-- | main/core/src/define/Discover.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/main/core/src/define/Discover.scala b/main/core/src/define/Discover.scala index f0c668e6..c7dab54c 100644 --- a/main/core/src/define/Discover.scala +++ b/main/core/src/define/Discover.scala @@ -79,9 +79,12 @@ object Discover { } if overridesRoutes.nonEmpty } yield { + // by wrapping the `overridesRoutes` in a lambda function we kind of work around + // the problem of generating a *huge* macro method body that finally exceeds the + // JVM's maximum allowed method size + val overridesLambda = q"(() => $overridesRoutes)()" val lhs = q"classOf[${discoveredModuleType.typeSymbol.asClass}]" - val rhs = q"scala.Seq[(Int, mill.util.Router.EntryPoint[_])](..$overridesRoutes)" - q"$lhs -> $rhs" + q"$lhs -> $overridesLambda" } c.Expr[Discover[T]](q"mill.define.Discover(scala.collection.immutable.Map(..$mapping))") |