aboutsummaryrefslogtreecommitdiff
path: root/core/shared/src
diff options
context:
space:
mode:
authorJon Pretty <jon.pretty@propensive.com>2017-11-30 19:32:09 +0100
committerGitHub <noreply@github.com>2017-11-30 19:32:09 +0100
commitd88b15e99e2727558bb901fcc08398862f633c11 (patch)
tree108d5b0fbdb814c8b85d7e9814f811adb94d7aeb /core/shared/src
parente2191e2687b671d4a8610544251e7e807f2793da (diff)
parent13fcfba5aa5d6a90b90c22088cb9b8da5e2823fe (diff)
downloadmagnolia-d88b15e99e2727558bb901fcc08398862f633c11.tar.gz
magnolia-d88b15e99e2727558bb901fcc08398862f633c11.tar.bz2
magnolia-d88b15e99e2727558bb901fcc08398862f633c11.zip
Merge pull request #56 from propensive/sealed-trait-typename-not-lowercased
typeName is now the full name of the type, in original case
Diffstat (limited to 'core/shared/src')
-rw-r--r--core/shared/src/main/scala/magnolia.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/shared/src/main/scala/magnolia.scala b/core/shared/src/main/scala/magnolia.scala
index c4c13e6..6528db0 100644
--- a/core/shared/src/main/scala/magnolia.scala
+++ b/core/shared/src/main/scala/magnolia.scala
@@ -223,10 +223,11 @@ object Magnolia {
val isValueClass = genericType <:< typeOf[AnyVal] && !primitives.exists(_ =:= genericType)
val resultType = appliedType(typeConstructor, genericType)
+
+ val className = s"${genericType.typeSymbol.owner.fullName}.${genericType.typeSymbol.name.decodedName}"
val result = if (isCaseObject) {
val obj = companionRef(genericType)
- val className = genericType.typeSymbol.name.decodedName.toString
val impl = q"""
${c.prefix}.combine($magnoliaPkg.Magnolia.caseClass[$typeConstructor, $genericType](
@@ -239,7 +240,6 @@ object Magnolia {
case m: MethodSymbol if m.isCaseAccessor || (isValueClass && m.isParamAccessor) =>
m.asMethod
}
- val className = genericType.typeSymbol.name.decodedName.toString
case class CaseParam(sym: c.universe.MethodSymbol,
repeated: Boolean,
@@ -372,13 +372,13 @@ object Magnolia {
val assignments = typeclasses.zipWithIndex.map {
case ((typ, typeclass), idx) =>
q"""$subtypesVal($idx) = $magnoliaPkg.Magnolia.subtype[$typeConstructor, $genericType, $typ](
- ${typ.typeSymbol.fullName.toString},
+ ${s"${typ.typeSymbol.owner.fullName}.${typ.typeSymbol.name.decodedName}"},
$typeclass,
(t: $genericType) => t.isInstanceOf[$typ],
(t: $genericType) => t.asInstanceOf[$typ]
)"""
}
-
+
Some {
Typeclass(
genericType,
@@ -389,7 +389,7 @@ object Magnolia {
..$assignments
${c.prefix}.dispatch(new $magnoliaPkg.SealedTrait(
- $genericTypeName,
+ $className,
$subtypesVal: $scalaPkg.Array[$magnoliaPkg.Subtype[$typeConstructor, $genericType]])
): $resultType
}"""