aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Pretty <jon.pretty@propensive.com>2018-01-05 16:09:23 +0100
committerGitHub <noreply@github.com>2018-01-05 16:09:23 +0100
commit0ace51eb792b9e036fc2399f6d318f3e5655bbd4 (patch)
treed0efa0b115414dd821845997379376b3427560fc
parentc2acc0fd2f4772ea1b6d3a59271fbe2d9063f69f (diff)
parentf7f7c4e6654e1e961e4d3c6f4eb216ab3e0cad21 (diff)
downloadmagnolia-0ace51eb792b9e036fc2399f6d318f3e5655bbd4.tar.gz
magnolia-0ace51eb792b9e036fc2399f6d318f3e5655bbd4.tar.bz2
magnolia-0ace51eb792b9e036fc2399f6d318f3e5655bbd4.zip
Merge pull request #69 from sirthias/md/fix-list-int
Fix regression introduced by move to `patchedCompanionRef`
-rw-r--r--core/shared/src/main/scala/magnolia.scala3
-rw-r--r--tests/src/main/scala/tests.scala4
2 files changed, 5 insertions, 2 deletions
diff --git a/core/shared/src/main/scala/magnolia.scala b/core/shared/src/main/scala/magnolia.scala
index b4179f9..c2fe742 100644
--- a/core/shared/src/main/scala/magnolia.scala
+++ b/core/shared/src/main/scala/magnolia.scala
@@ -225,11 +225,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))
diff --git a/tests/src/main/scala/tests.scala b/tests/src/main/scala/tests.scala
index 5b47627..6c2ab9a 100644
--- a/tests/src/main/scala/tests.scala
+++ b/tests/src/main/scala/tests.scala
@@ -318,6 +318,10 @@ object Tests extends TestApp {
test("show a Portfolio of Companies") {
Show.gen[Portfolio].show(Portfolio(Company("Alice Inc"), Company("Bob & Co")))
}.assert(_ == "Portfolio(companies=[Company(name=Alice Inc),Company(name=Bob & Co)])")
+
+ test("show a List[Int]") {
+ Show.gen[List[Int]].show(List(1, 2, 3))
+ }.assert(_ == "::(head=1,tl$access$1=::(head=2,tl$access$1=::(head=3,tl$access$1=Nil())))")
test("sealed trait typeName should be complete and unchanged") {
TypeNameInfo.gen[Color].name