Skip to content
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

Cross compile to Scala Native #301

Merged
merged 17 commits into from
Feb 5, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
"Fix" compile error
fthomas committed Feb 4, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a14628cfc132b05dbfcff2fe0a094e260c39dcd6
Original file line number Diff line number Diff line change
@@ -24,11 +24,11 @@ trait RefType[F[_, _]] extends Serializable {

def unsafeRewrap[T, A, B](ta: F[T, A]): F[T, B]

def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
t: c.Expr[T]): c.Expr[F[T, P]]
//def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
// t: c.Expr[T]): c.Expr[F[T, P]]

def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](c: blackbox.Context)(
ta: c.Expr[F[T, A]]): c.Expr[F[T, B]]
//def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](c: blackbox.Context)(
// ta: c.Expr[F[T, A]]): c.Expr[F[T, B]]

/**
* Returns a value of type `T` refined as `F[T, P]` on the right if
@@ -161,12 +161,12 @@ object RefType {
override def unsafeRewrap[T, A, B](ta: Refined[T, A]): Refined[T, B] =
Refined.unsafeApply(ta.value)

override def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
t: c.Expr[T]): c.Expr[Refined[T, P]] =
c.universe.reify(Refined.unsafeApply(t.splice))

override def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](
c: blackbox.Context)(ta: c.Expr[Refined[T, A]]): c.Expr[Refined[T, B]] =
def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](c: blackbox.Context)(
ta: c.Expr[Refined[T, A]]): c.Expr[Refined[T, B]] =
c.universe.reify(Refined.unsafeApply(ta.splice.value))
}

@@ -181,12 +181,12 @@ object RefType {
override def unsafeRewrap[T, A, B](ta: T @@ A): T @@ B =
ta.asInstanceOf[T @@ B]

override def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
def unsafeWrapM[T: c.WeakTypeTag, P: c.WeakTypeTag](c: blackbox.Context)(
t: c.Expr[T]): c.Expr[T @@ P] =
c.universe.reify(t.splice.asInstanceOf[T @@ P])

override def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](
c: blackbox.Context)(ta: c.Expr[T @@ A]): c.Expr[T @@ B] =
def unsafeRewrapM[T: c.WeakTypeTag, A: c.WeakTypeTag, B: c.WeakTypeTag](c: blackbox.Context)(
ta: c.Expr[T @@ A]): c.Expr[T @@ B] =
c.universe.reify(ta.splice.asInstanceOf[T @@ B])
}

Original file line number Diff line number Diff line change
@@ -20,6 +20,6 @@ class InferMacro(val c: blackbox.Context) extends MacroUtils {
abort(Resources.invalidInference(weakTypeOf[A].toString, weakTypeOf[B].toString))
}

refTypeInstance(rt).unsafeRewrapM(c)(ta)
???
}
}
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class RefineMacro(val c: blackbox.Context) extends MacroUtils with LiteralMatche
abort(validate.showResult(tValue, res))
}

refTypeInstance(rt).unsafeWrapM(c)(t)
???
}

def implApplyRef[FTP, F[_, _], T: c.WeakTypeTag, P: c.WeakTypeTag](t: c.Expr[T])(