Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ object IsUnion {
import quotes.reflect.*
val tpe: TypeRepr = TypeRepr.of[A]
tpe.dealias match {
case o: OrType => '{ IsUnion.singleton.asInstanceOf[IsUnion[A]] }.asExprOf[IsUnion[A]]
case other => report.errorAndAbort(s"${tpe.show} is not a Union")
case _: OrType => '{ IsUnion.singleton.asInstanceOf[IsUnion[A]] }.asExprOf[IsUnion[A]]
case _ => report.errorAndAbort(s"${tpe.show} is not a Union")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ object UnionDerivation {
val instanceTree = lambda match {
case Block(body, Closure(method, _)) =>
Block(body, Closure(method, Some(TypeRepr.of[F].appliedTo(tpe))))
case other =>
errorAndAbort(s"unexpected lambda tree: ${other.show}")
}

instanceTree.asExprOf[F[A]]

case other =>
case _ =>
errorAndAbort("only Union type is supported.")
}
}
Expand Down Expand Up @@ -218,7 +220,7 @@ object UnionDerivation {
val tcl = lookupImplicit(tpe)

val args: List[Term] = params.zip(lambdaArgs).map {
case (param, arg) if param.isPoly =>
case (param, _) if param.isPoly =>
Select.unique(selector, "asInstanceOf").appliedToType(tpe)

case (_, arg) =>
Expand Down Expand Up @@ -257,6 +259,7 @@ object UnionDerivation {
Implicits.search(tclTpe) match {
case success: ImplicitSearchSuccess => success.tree
case failure: ImplicitSearchFailure => errorAndAbort(failure.explanation)
case other => errorAndAbort(s"unexpected implicit search result: $other")
}
}

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.9.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.2")
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.2")
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.7")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.22.0")
addSbtPlugin("org.typelevel" % "sbt-typelevel-github-actions" % "0.8.6")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
Expand Down
Loading