diff --git a/airframe-surface/.jvm/src/main/scala-2/wvlet/airframe/surface/reflect/ReflectSurfaceFactory.scala b/airframe-surface/.jvm/src/main/scala-2/wvlet/airframe/surface/reflect/ReflectSurfaceFactory.scala index 7097d3ce4d..c11273c069 100644 --- a/airframe-surface/.jvm/src/main/scala-2/wvlet/airframe/surface/reflect/ReflectSurfaceFactory.scala +++ b/airframe-surface/.jvm/src/main/scala-2/wvlet/airframe/surface/reflect/ReflectSurfaceFactory.scala @@ -55,7 +55,7 @@ object ReflectSurfaceFactory extends LogSupport { val tpe = cs.toType ofType(tpe) match { // Workaround for sbt's layered class loader, which cannot find the original classes using the reflect mirror - case Alias(_, _, AnyRefSurface) if cs.isTrait => + case Alias(_, _, AnyRefSurface, _) if cs.isTrait => new GenericSurface(cls) case other => other } @@ -436,7 +436,8 @@ object ReflectSurfaceFactory extends LogSupport { val name = symbol.asType.name.decodedName.toString val fullName = s"${prefix.typeSymbol.fullName}.${name}" - val a = Alias(name, fullName, inner) + val typeArgs = typeArgsOf(alias).map(surfaceOf(_)).toIndexedSeq + val a = Alias(name, fullName, inner, typeArgs) a } @@ -619,7 +620,7 @@ object ReflectSurfaceFactory extends LogSupport { // For example, trait MyTag, which has no implementation will be just an java.lang.Object val name = t.typeSymbol.name.decodedName.toString val fullName = s"${prefix.typeSymbol.fullName}.${name}" - Alias(name, fullName, AnyRefSurface) + Alias(name, fullName, AnyRefSurface, Seq.empty) case t @ RefinedType(List(_, baseType), decl) => // For traits with extended methods new GenericSurface(resolveClass(baseType)) diff --git a/airframe-surface/src/main/scala-2/wvlet/airframe/surface/SurfaceMacros.scala b/airframe-surface/src/main/scala-2/wvlet/airframe/surface/SurfaceMacros.scala index d64153d236..3c20f144e7 100644 --- a/airframe-surface/src/main/scala-2/wvlet/airframe/surface/SurfaceMacros.scala +++ b/airframe-surface/src/main/scala-2/wvlet/airframe/surface/SurfaceMacros.scala @@ -238,7 +238,8 @@ private[surface] object SurfaceMacros { } val name = symbol.asType.name.decodedName.toString val fullName = s"${prefix.typeSymbol.fullName}.${name}" - q"wvlet.airframe.surface.Alias(${name}, ${fullName}, $inner)" + val typeArgs = args.map(surfaceOf(_)) + q"wvlet.airframe.surface.Alias(${name}, ${fullName}, ${inner}, Seq(..${typeArgs}))" } private val higherKindedTypeFactory: SurfaceFactory = { @@ -626,7 +627,7 @@ private[surface] object SurfaceMacros { private val genericSurfaceFactory: SurfaceFactory = { case t if t =:= typeOf[Any] => - q"wvlet.airframe.surface.Alias(${"Any"}, ${"scala.Any"}, wvlet.airframe.surface.AnyRefSurface)" + q"wvlet.airframe.surface.Alias(${"Any"}, ${"scala.Any"}, wvlet.airframe.surface.AnyRefSurface, Seq.empty)" case t @ TypeRef(prefix, symbol, args) if !args.isEmpty => val typeArgs = typeArgsOf(t).map(surfaceOf(_)) q"new wvlet.airframe.surface.GenericSurface(classOf[$t], typeArgs = IndexedSeq(..$typeArgs))" diff --git a/airframe-surface/src/main/scala/wvlet/airframe/surface/Surfaces.scala b/airframe-surface/src/main/scala/wvlet/airframe/surface/Surfaces.scala index 7a8b2bcb11..f83d94a6aa 100644 --- a/airframe-surface/src/main/scala/wvlet/airframe/surface/Surfaces.scala +++ b/airframe-surface/src/main/scala/wvlet/airframe/surface/Surfaces.scala @@ -213,7 +213,7 @@ case class Alias( override val name: String, override val fullName: String, ref: Surface, - override val typeArgs: Seq[Surface] + override val typeArgs: Seq[Surface] = Seq.empty ) extends GenericSurface(ref.rawType, typeArgs, ref.params, ref.objectFactory) { override def toString: String = { val typeSuffix = if (typeArgs.isEmpty) {