diff options
Diffstat (limited to 'core/shared/src/main/scala/magnolia.scala')
-rw-r--r-- | core/shared/src/main/scala/magnolia.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/shared/src/main/scala/magnolia.scala b/core/shared/src/main/scala/magnolia.scala index 67e948e..b5c196a 100644 --- a/core/shared/src/main/scala/magnolia.scala +++ b/core/shared/src/main/scala/magnolia.scala @@ -229,11 +229,10 @@ object Magnolia { } val result = if (isCaseObject) { - val obj = GlobalUtil.patchedCompanionRef(c)(genericType) val impl = q""" $typeNameDef ${c.prefix}.combine($magnoliaPkg.Magnolia.caseClass[$typeConstructor, $genericType]( - $typeName, true, false, new $scalaPkg.Array(0), _ => $obj) + $typeName, true, false, new $scalaPkg.Array(0), _ => ${genericType.typeSymbol.asClass.module}) ) """ Some(Typeclass(genericType, impl)) @@ -381,7 +380,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] @@ -468,10 +467,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) |