-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid deprecated macro APIs post 2.10 #2534
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package cats | ||
package arrow | ||
|
||
import cats.data.{EitherK, Tuple2K} | ||
import scala.reflect.macros.blackbox.Context | ||
|
||
import cats.macros.MacroCompat | ||
import cats.data.{EitherK, Tuple2K} | ||
|
||
/** | ||
* `FunctionK[F[_], G[_]]` is a functor transformation from `F` to `G` | ||
|
@@ -95,7 +95,7 @@ object FunctionK { | |
|
||
} | ||
|
||
private[arrow] object FunctionKMacros extends MacroCompat { | ||
private[arrow] object FunctionKMacros { | ||
|
||
def lift[F[_], G[_]](c: Context)( | ||
f: c.Expr[(F[α] ⇒ G[α]) forSome { type α }] | ||
|
@@ -124,7 +124,7 @@ private[arrow] object FunctionKMacros extends MacroCompat { | |
val G = punchHole(evG.tpe) | ||
|
||
q""" | ||
new FunctionK[$F, $G] { | ||
new _root_.cats.arrow.FunctionK[$F, $G] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a hygiene issue that I fixed along the way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
def apply[A](fa: $F[A]): $G[A] = $trans(fa) | ||
} | ||
""" | ||
|
@@ -139,7 +139,7 @@ private[arrow] object FunctionKMacros extends MacroCompat { | |
|
||
private[this] def punchHole(tpe: Type): Tree = tpe match { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to take a moment to appreciate the name of this method. |
||
case PolyType(undet :: Nil, underlying: TypeRef) ⇒ | ||
val α = compatNewTypeName(c, "α") | ||
val α = TypeName("α") | ||
def rebind(typeRef: TypeRef): Tree = | ||
if (typeRef.sym == undet) tq"$α" | ||
else { | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize that the approach in #2509 would require a
publishLocal
first. This here may be simpler.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. I was testing against existing published jars, didn't realize that I can just do module dependency.