Skip to content

Commit

Permalink
Give a try to the solution provided by @ghik here: scala-js/scala-js#…
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Feb 7, 2025
1 parent 8c773df commit 7984a2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package zio.prelude
object NewtypeSpecTypes212 {

object Palindrome extends Newtype[String] {
override def assertion = assertCustom { str =>
override def assertion = assertCustom { (str: String) =>
if (str.reverse == str) Right(()) else Left(AssertionError.Failure("isPalindrome"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions macros/shared/src/main/scala-2/zio/prelude/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ new _root_.zio.prelude.QuotedAssertion[${c.weakTypeOf[A]}] {
val (_, _, codeString) = text(f)
q"""
new _root_.zio.prelude.QuotedAssertion[${c.weakTypeOf[A]}] {
@_root_.zio.prelude.assertionLambdaQuote($f)
@_root_.zio.prelude.assertionLambdaQuote(${c.untypecheck(f)})
@_root_.zio.prelude.assertionString($codeString)
def magic = 42

def run(value: ${c.weakTypeOf[A]}): _root_.scala.util.Either[_root_.zio.prelude.AssertionError, _root_.scala.Unit] =
$f(value)
${c.untypecheck(f)}(value)
}
"""
}
Expand Down

0 comments on commit 7984a2e

Please sign in to comment.