aboutsummaryrefslogtreecommitdiff
path: root/core/shared/src/main/scala/magnolia.scala
diff options
context:
space:
mode:
authorJon Pretty <jon.pretty@propensive.com>2018-01-05 16:11:10 +0100
committerGitHub <noreply@github.com>2018-01-05 16:11:10 +0100
commit235f2ddd5adf5c99cf53d6e6321dbe5e2fd842c2 (patch)
tree88b9e98cba35ea13ade0caaf8db978848b465ee5 /core/shared/src/main/scala/magnolia.scala
parent0ace51eb792b9e036fc2399f6d318f3e5655bbd4 (diff)
parent6ce9fd4ce13ca5fae1c4bc8d2ba3af72bbd4dbf5 (diff)
downloadmagnolia-235f2ddd5adf5c99cf53d6e6321dbe5e2fd842c2.tar.gz
magnolia-235f2ddd5adf5c99cf53d6e6321dbe5e2fd842c2.tar.bz2
magnolia-235f2ddd5adf5c99cf53d6e6321dbe5e2fd842c2.zip
Merge pull request #71 from sirthias/md/typename
Switch `Subtype#label` member to new `TypeName`
Diffstat (limited to 'core/shared/src/main/scala/magnolia.scala')
-rw-r--r--core/shared/src/main/scala/magnolia.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/shared/src/main/scala/magnolia.scala b/core/shared/src/main/scala/magnolia.scala
index c2fe742..b61d1c0 100644
--- a/core/shared/src/main/scala/magnolia.scala
+++ b/core/shared/src/main/scala/magnolia.scala
@@ -376,7 +376,7 @@ object Magnolia {
val assignments = typeclasses.zipWithIndex.map {
case ((typ, typeclass), idx) =>
q"""$subtypesVal($idx) = $magnoliaPkg.Magnolia.subtype[$typeConstructor, $genericType, $typ](
- ${s"${typ.typeSymbol.owner.fullName}.${typ.typeSymbol.name.decodedName}"},
+ $magnoliaPkg.TypeName(${typ.typeSymbol.owner.fullName}, ${typ.typeSymbol.name.decodedName.toString}),
$typeclass,
(t: $genericType) => t.isInstanceOf[$typ],
(t: $genericType) => t.asInstanceOf[$typ]
@@ -459,10 +459,10 @@ object Magnolia {
*
* This method is intended to be called only from code generated by the Magnolia macro, and
* should not be called directly from users' code. */
- def subtype[Tc[_], T, S <: T](name: String, tc: => Tc[S], isType: T => Boolean, asType: T => S): Subtype[Tc, T] =
+ def subtype[Tc[_], T, S <: T](name: TypeName, tc: => Tc[S], isType: T => Boolean, asType: T => S): Subtype[Tc, T] =
new Subtype[Tc, T] with PartialFunction[T, S] {
type SType = S
- def label: String = name
+ def typeName: TypeName = name
def typeclass: Tc[SType] = tc
def cast: PartialFunction[T, SType] = this
def isDefinedAt(t: T) = isType(t)