Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
1 change: 1 addition & 0 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ object BuildHelper {
Seq(
"-language:implicitConversions",
"-Xignore-scala2-macros",
"-Xmax-inlines:64",
"-noindent"
)
case Some((2, 13)) =>
Expand Down
12 changes: 10 additions & 2 deletions test/shared/src/main/scala-3/zio/test/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ package zio.test

import zio._
import zio.internal.stacktracer.SourceLocation
import zio.test.internal.SmartAssertions
import zio.test.diff.Diff
import zio.test.internal.{OptionalImplicit, SmartAssertions}

import scala.quoted._
import scala.reflect.ClassTag
Expand Down Expand Up @@ -166,7 +167,14 @@ object SmartAssertMacros {

case Unseal(MethodCall(lhs, "==", tpes, Some(List(rhs)))) =>
val span = getSpan(rhs)
'{${transform(lhs.asExpr)} >>> SmartAssertions.equalTo(${rhs.asExpr}).span($span)}.asExprOf[TestArrow[Any, A]]
lhs.tpe.widen.asType match {
case '[l] =>
Expr.summon[OptionalImplicit[Diff[l]]] match {
case Some(optDiff) =>
'{${transform(lhs.asExpr)} >>> SmartAssertions.equalTo(${rhs.asExpr})($optDiff.asInstanceOf[OptionalImplicit[Diff[Any]]]).span($span)}.asExprOf[TestArrow[Any, A]]
case _ => throw new Error("OptionalImplicit should be always available")
}
}

case Unseal(MethodCall(lhs, "&&", tpes, Some(List(rhs)))) if isBool(lhs) =>
val span = getSpan(rhs)
Expand Down