Skip to content

Commit

Permalink
Merge pull request #21 from eed3si9n/wip/dotty
Browse files Browse the repository at this point in the history
Dotty 0.17.0-RC1
  • Loading branch information
eed3si9n authored Jul 24, 2019
2 parents bef9e00 + efcfa76 commit 3a70826
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ matrix:
include:
- scala: 2.12.8
jdk: openjdk11
- scala: 0.16.0-RC3
- scala: 0.17.0-RC1
jdk: openjdk8
script: sbt ++${TRAVIS_SCALA_VERSION}! expectyJVM/test
- scala: 2.11.12
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ThisBuild / version := "0.12.1-SNAPSHOT"
val scala211 = "2.11.12"
val scala212 = "2.12.8"
val scala213 = "2.13.0"
val scalaDotty = "0.16.0-RC3"
val scalaDotty = "0.17.0-RC1"
ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Vector(scala212, scala213, scala211, scalaDotty)

Expand Down
25 changes: 6 additions & 19 deletions shared/src/main/scala-3/com/eed3si9n/expecty/RecorderMacro.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ object RecorderMacro {

def apply(
recording: Expr[Boolean],
listener: Expr[RecorderListener[Boolean]])(implicit reflect: Reflection): Expr[Unit] = {
listener: Expr[RecorderListener[Boolean]]) given (qctx: QuoteContext): Expr[Unit] = {
apply(recording, '{""}, listener)
}

def apply(
recording: Expr[Boolean],
message: Expr[String],
listener: Expr[RecorderListener[Boolean]])(implicit reflect: Reflection): Expr[Unit] = {
import reflect._
listener: Expr[RecorderListener[Boolean]]) given (qctx: QuoteContext): Expr[Unit] = {
import qctx.tasty._
val termArg: Term = recording.unseal.underlyingArgument

def getText(expr: Tree): String = {
Expand Down Expand Up @@ -71,8 +71,8 @@ object RecorderMacro {
val instrumented = recordAllValues(expr)
Apply(recordExpressionSel,
List(
Literal(Constant.String(text)),
Literal(Constant.String(ast)),
Literal(Constant(text)),
Literal(Constant(ast)),
instrumented
))
}
Expand Down Expand Up @@ -132,7 +132,7 @@ object RecorderMacro {
tapply,
List(
expr,
Literal(Constant.Int(getAnchor(expr)))
Literal(Constant(getAnchor(expr)))
)
)
}
Expand All @@ -156,17 +156,4 @@ object RecorderMacro {
()
}
}

// 0.17.0 nightly
// def apply(expr: Expr[Boolean]) given (qctx: QuoteContext): Expr[Unit] = {
// import qctx.tasty._
// import util._
// val termArg: Term = expr.unseal.underlyingArgument
// val errorMessage: Expr[Any] = Literal(Constant(termArg.toString)).seal
// '{
// if (!$expr) {
// throw new AssertionError(s"failed assertion: ${ $errorMessage }")
// }
// }
// }
}

0 comments on commit 3a70826

Please sign in to comment.