aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorKevin Wright <kevin.wright@bradyplc.com>2018-02-08 21:20:53 +0000
committerKevin Wright <kevin.wright@bradyplc.com>2018-02-08 21:20:53 +0000
commitc1b9c1f53a6bb3f62abc7141e6b6153d8208e1f0 (patch)
treee867d326898b1e7d0019753728b921c3a160167c /core
parent6660480a75b240b7ac613ed308e5b7f7ddfc6459 (diff)
downloadmagnolia-c1b9c1f53a6bb3f62abc7141e6b6153d8208e1f0.tar.gz
magnolia-c1b9c1f53a6bb3f62abc7141e6b6153d8208e1f0.tar.bz2
magnolia-c1b9c1f53a6bb3f62abc7141e6b6153d8208e1f0.zip
post-review changes
Diffstat (limited to 'core')
-rw-r--r--core/shared/src/main/scala/interface.scala2
-rw-r--r--core/shared/src/main/scala/magnolia.scala6
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)