diff --git a/.travis.yml b/.travis.yml index e844b3201..3df831dc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: scala scala: - 2.11.7 -- 2.12.0-M1 +- 2.12.0-M2 jdk: - oraclejdk8 diff --git a/core/src/main/scala/shapeless/generic.scala b/core/src/main/scala/shapeless/generic.scala index 68970b099..a9be09749 100644 --- a/core/src/main/scala/shapeless/generic.scala +++ b/core/src/main/scala/shapeless/generic.scala @@ -780,7 +780,7 @@ class GenericMacros(val c: whitebox.Context) extends CaseClassMacros { def to(p: $tpe): Repr = (p match { case ..$toCases }).asInstanceOf[Repr] def from(p: Repr): $tpe = p match { case ..$fromCases } } - new $clsName() + new $clsName(): _root_.shapeless.Generic.Aux[$tpe, ${reprTypTree(tpe)}] """ } @@ -807,7 +807,7 @@ class GenericMacros(val c: whitebox.Context) extends CaseClassMacros { def to(p: $tpe): Repr = $to def from(p: Repr): $tpe = _root_.shapeless.Coproduct.unsafeGet(p).asInstanceOf[$tpe] } - new $clsName() + new $clsName(): _root_.shapeless.Generic.Aux[$tpe, ${reprTypTree(tpe)}] """ } diff --git a/core/src/main/scala/shapeless/generic1.scala b/core/src/main/scala/shapeless/generic1.scala index 6ff0cd40a..ab44b6dd4 100644 --- a/core/src/main/scala/shapeless/generic1.scala +++ b/core/src/main/scala/shapeless/generic1.scala @@ -207,6 +207,7 @@ class Generic1Macros(val c: whitebox.Context) extends CaseClassMacros { val tpeTpt = appliedTypTree1(tpe, param1(tpe), nme) val reprTpt = reprTypTree1(tpe, nme) val frTpt = mkAttributedRef(frTpe) + val rnme = TypeName(c.freshName) val clsName = TypeName(c.freshName()) q""" @@ -218,7 +219,8 @@ class Generic1Macros(val c: whitebox.Context) extends CaseClassMacros { def to[$nme](ft: $tpeTpt): R[$nme] = ft match { case ..$toCases } def from[$nme](rt: R[$nme]): $tpeTpt = rt match { case ..$fromCases } } - new $clsName() + type $rnme[$nme] = $reprTpt + new $clsName(): _root_.shapeless.Generic1.Aux[$tpe, $frTpe, $rnme] """ } @@ -237,6 +239,7 @@ class Generic1Macros(val c: whitebox.Context) extends CaseClassMacros { val tpeTpt = appliedTypTree1(tpe, param1(tpe), nme) val reprTpt = reprTypTree1(tpe, nme) val frTpt = mkAttributedRef(frTpe) + val rnme = TypeName(c.freshName) val to = { val toCases = ctorsOf1(tpe) zip (Stream from 0) map (mkCoproductCases _).tupled @@ -253,7 +256,8 @@ class Generic1Macros(val c: whitebox.Context) extends CaseClassMacros { def to[$nme](ft: $tpeTpt): R[$nme] = $to def from[$nme](rt: R[$nme]): $tpeTpt = _root_.shapeless.Coproduct.unsafeGet(rt).asInstanceOf[$tpeTpt] } - new $clsName() + type $rnme[$nme] = $reprTpt + new $clsName(): _root_.shapeless.Generic1.Aux[$tpe, $frTpe, $rnme] """ } } diff --git a/project/Build.scala b/project/Build.scala index ee140bcdd..3af3b5c7e 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -164,7 +164,7 @@ object ShapelessBuild extends Build { Seq( organization := "com.chuusai", scalaVersion := "2.11.7", - crossScalaVersions := Seq("2.11.7", "2.12.0-M1"), + crossScalaVersions := Seq("2.11.7", "2.12.0-M2"), (unmanagedSourceDirectories in Compile) <<= (scalaSource in Compile)(Seq(_)), (unmanagedSourceDirectories in Test) <<= (scalaSource in Test)(Seq(_)),