diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/shared/src/main/scala/interface.scala | 2 | ||||
-rw-r--r-- | core/shared/src/main/scala/magnolia.scala | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/shared/src/main/scala/interface.scala b/core/shared/src/main/scala/interface.scala index 97ea5b7..1dac65e 100644 --- a/core/shared/src/main/scala/interface.scala +++ b/core/shared/src/main/scala/interface.scala @@ -113,6 +113,7 @@ trait Param[Typeclass[_], Type] { * @param typeName the name of the case class * @param isObject true only if this represents a case object rather than a case class * @param parametersArray an array of [[Param]] values for this case class + * @param annotationsArray an array of instantiated annotations applied to this case class * @tparam Typeclass type constructor for the typeclass being derived * @tparam Type generic type of this parameter */ abstract class CaseClass[Typeclass[_], Type] private[magnolia] ( @@ -174,6 +175,7 @@ abstract class CaseClass[Typeclass[_], Type] private[magnolia] ( * which form a coproduct, and to the fully-qualified name of the sealed trait. * @param typeName the name of the sealed trait * @param subtypesArray an array of [[Subtype]] instances for each subtype in the sealed trait + * @param annotationsArray an array of instantiated annotations applied to this case class * @tparam Typeclass type constructor for the typeclass being derived * @tparam Type generic type of this parameter */ final class SealedTrait[Typeclass[_], Type]( diff --git a/core/shared/src/main/scala/magnolia.scala b/core/shared/src/main/scala/magnolia.scala index 00cf5ec..3cfda3d 100644 --- a/core/shared/src/main/scala/magnolia.scala +++ b/core/shared/src/main/scala/magnolia.scala @@ -202,7 +202,8 @@ object Magnolia { val headParamList = { val primaryConstructor = classType map (_.primaryConstructor) - val optList: Option[List[c.universe.Symbol]] = primaryConstructor flatMap (_.typeSignature.paramLists.headOption) + val optList: Option[List[c.universe.Symbol]] = + primaryConstructor flatMap (_.asMethod.typeSignature.paramLists.headOption) optList.map(_.map(_.asTerm)) } @@ -256,10 +257,11 @@ object Magnolia { val preAssignments = caseParams.map(_.typeclass) - val defaults = headParamList.filterNot(_ => isValueClass) map { plist => + val defaults = headParamList map { plist => // note: This causes the namer/typer to generate the synthetic default methods by forcing // the typeSignature of the "default" factory method to be visited. // It feels like it shouldn't be needed, but we'll get errors otherwise (as discovered after 6 hours debugging) + val companionSym = companionRef.symbol.asModule.info val primaryFactoryMethod = companionSym.decl(TermName("apply")).alternatives.lastOption primaryFactoryMethod.foreach(_.asMethod.typeSignature) |