Skip to content

Commit b10f297

Browse files
committed
Adjustments for dotty 0.14.0-bin-20190403-d00a7ba-NIGHTLY.
1 parent 5f1fda1 commit b10f297

File tree

11 files changed

+69
-69
lines changed

11 files changed

+69
-69
lines changed

project/scalatest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ object ScalatestBuild {
21352135
import dotty.tools.sbtplugin.DottyPlugin.autoImport._
21362136
// List of available night build at https://repo1.maven.org/maven2/ch/epfl/lamp/dotty-compiler_0.14/
21372137
//lazy val dottyVersion = dottyLatestNightlyBuild.get
2138-
lazy val dottyVersion = "0.14.0-bin-20190401-f62e286-NIGHTLY"
2138+
lazy val dottyVersion = "0.14.0-bin-20190403-d00a7ba-NIGHTLY"
21392139
lazy val dottySettings = List(
21402140
scalaVersion := dottyVersion,
21412141
libraryDependencies := libraryDependencies.value.map(_.withDottyCompat(scalaVersion.value)),

scalactic.dotty/src/main/scala/org/scalactic/BooleanMacro.scala

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import scala.tasty._
2121
object BooleanMacro {
2222
def parse(condition: Expr[Boolean], prettifier: Expr[Prettifier])(implicit refl: Reflection): Expr[Bool] = {
2323
import refl._
24-
import quoted.Toolbox.Default._
24+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
2525
import util._
2626

2727
def exprStr: String = condition.show
@@ -34,31 +34,31 @@ object BooleanMacro {
3434
let(lhs) { left =>
3535
let(rhs) { right =>
3636
let(Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil)) { result =>
37-
val l = left.seal[Any]
38-
val r = right.seal[Any]
39-
val b = result.seal[Boolean]
37+
val l = left.seal
38+
val r = right.seal
39+
val b = result.seal.cast[Boolean]
4040
val code = '{ Bool.binaryMacroBool($l, ${ op.toExpr }, $r, $b, $prettifier) }
4141
code.unseal
4242
}
4343
}
44-
}.seal[Bool]
44+
}.seal.cast[Bool]
4545
case Apply(sel @ Select(lhs, op), rhs :: Nil) =>
4646
op match {
4747
case "||" =>
48-
val left = parse(lhs.seal[Boolean], prettifier)
49-
val right = parse(rhs.seal[Boolean], prettifier)
48+
val left = parse(lhs.seal.cast[Boolean], prettifier)
49+
val right = parse(rhs.seal.cast[Boolean], prettifier)
5050
'{ $left || $right }
5151
case "|" =>
52-
val left = parse(lhs.seal[Boolean], prettifier)
53-
val right = parse(rhs.seal[Boolean], prettifier)
52+
val left = parse(lhs.seal.cast[Boolean], prettifier)
53+
val right = parse(rhs.seal.cast[Boolean], prettifier)
5454
'{ $left | $right }
5555
case "&&" =>
56-
val left = parse(lhs.seal[Boolean], prettifier)
57-
val right = parse(rhs.seal[Boolean], prettifier)
56+
val left = parse(lhs.seal.cast[Boolean], prettifier)
57+
val right = parse(rhs.seal.cast[Boolean], prettifier)
5858
'{ $left && $right }
5959
case "&" =>
60-
val left = parse(lhs.seal[Boolean], prettifier)
61-
val right = parse(rhs.seal[Boolean], prettifier)
60+
val left = parse(lhs.seal.cast[Boolean], prettifier)
61+
val right = parse(rhs.seal.cast[Boolean], prettifier)
6262
'{ $left & $right }
6363
case _ =>
6464
sel.tpe.widen match {
@@ -70,31 +70,31 @@ object BooleanMacro {
7070
val app = Select.overloaded(left, op, Nil, right :: Nil)
7171
assert(app.symbol == sel.symbol, app.symbol.fullName -> sel.symbol.fullName)
7272
let(app) { result =>
73-
val l = left.seal[Any]
74-
val r = right.seal[Any]
75-
val b = result.seal[Boolean]
73+
val l = left.seal
74+
val r = right.seal
75+
val b = result.seal.cast[Boolean]
7676
val code = '{ Bool.binaryMacroBool($l, ${op.toExpr}, $r, $b, $prettifier) }
7777
code.unseal
7878
}
7979
}
80-
}.seal[Bool]
80+
}.seal.cast[Bool]
8181
}
8282
}
8383
case Apply(f @ Apply(Select(Apply(qual, lhs :: Nil), op @ ("===" | "!==")), rhs :: Nil), implicits)
8484
if isImplicitMethodType(f.tpe) =>
8585
let(lhs) { left =>
8686
let(rhs) { right =>
8787
let(Apply(Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil), implicits)) { result =>
88-
val l = left.seal[Any]
89-
val r = right.seal[Any]
90-
val b = result.seal[Boolean]
88+
val l = left.seal
89+
val r = right.seal
90+
val b = result.seal.cast[Boolean]
9191
val code = '{ Bool.binaryMacroBool($l, ${ op.toExpr }, $r, $b, $prettifier) }
9292
code.unseal
9393
}
9494
}
95-
}.seal[Bool]
95+
}.seal.cast[Bool]
9696
case Select(left, "unary_!") =>
97-
val receiver = parse(left.seal[Boolean], prettifier)
97+
val receiver = parse(left.seal.cast[Boolean], prettifier)
9898
'{ !($receiver) }
9999
case Literal(_) =>
100100
'{ Bool.simpleMacroBool($condition, "", $prettifier) }

scalactic.dotty/src/main/scala/org/scalactic/Requirements.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ object RequirementsMacro {
233233
*/
234234
def require(condition: Expr[Boolean], prettifier: Expr[Prettifier], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = {
235235
import refl._
236-
import quoted.Toolbox.Default._
236+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
237237

238238
val bool = BooleanMacro.parse(condition, prettifier)
239239
'{ Requirements.requirementsHelper.macroRequire($bool, $clue) }
@@ -248,7 +248,7 @@ object RequirementsMacro {
248248
*/
249249
def requireState(condition: Expr[Boolean], prettifier: Expr[Prettifier], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = {
250250
import refl._
251-
import quoted.Toolbox.Default._
251+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
252252

253253
val bool = BooleanMacro.parse(condition, prettifier)
254254
'{ Requirements.requirementsHelper.macroRequireState($bool, $clue) }
@@ -263,7 +263,7 @@ object RequirementsMacro {
263263
*/
264264
def requireNonNull(arguments: Expr[Seq[Any]], prettifier: Expr[Prettifier], pos: Expr[source.Position])(implicit reflect: Reflection): Expr[Unit] = {
265265
import reflect._
266-
import quoted.Toolbox.Default._
266+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
267267

268268
def liftSeq(args: Seq[Expr[String]]): Expr[Seq[String]] = args match {
269269
case x :: xs => '{ ($x) +: ${ liftSeq(xs) } }
@@ -272,7 +272,7 @@ object RequirementsMacro {
272272

273273
val argStr: List[Expr[String]] = arguments.unseal.underlyingArgument match {
274274
case Typed(Repeated(args, _), _) => // only sequence literal
275-
args.map(arg => arg.seal[Any].show.toExpr)
275+
args.map(arg => arg.seal.cast[Any].show.toExpr)
276276
case _ =>
277277
throw QuoteError("requireNonNull can only be used with sequence literal, not `seq : _*`")
278278
}

scalactic.dotty/src/main/scala/org/scalactic/anyvals/CompileTimeAssertions.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ trait CompileTimeAssertions {
208208
case Literal(intConst) =>
209209
val literalValue = intConst.value.toString.toInt
210210
if (!isValid(literalValue))
211-
throw new TastyTypecheckError(notValidMsg)
211+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
212212
case _ =>
213-
throw new TastyTypecheckError(notLiteralMsg)
213+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
214214
}
215215
}
216216

@@ -243,9 +243,9 @@ trait CompileTimeAssertions {
243243
case Literal(longConst) =>
244244
val literalValue = longConst.value.toString.toLong
245245
if (!isValid(literalValue))
246-
throw new TastyTypecheckError(notValidMsg)
246+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
247247
case _ =>
248-
throw new TastyTypecheckError(notLiteralMsg)
248+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
249249
}
250250
}
251251

@@ -278,9 +278,9 @@ trait CompileTimeAssertions {
278278
case Literal(floatConst) =>
279279
val literalValue = floatConst.value.toString.toFloat
280280
if (!isValid(literalValue))
281-
throw new TastyTypecheckError(notValidMsg)
281+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
282282
case _ =>
283-
throw new TastyTypecheckError(notLiteralMsg)
283+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
284284
}
285285
}
286286

@@ -313,9 +313,9 @@ trait CompileTimeAssertions {
313313
case Literal(doubleConst) =>
314314
val literalValue = doubleConst.value.toString.toDouble
315315
if (!isValid(literalValue))
316-
throw new TastyTypecheckError(notValidMsg)
316+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
317317
case _ =>
318-
throw new TastyTypecheckError(notLiteralMsg)
318+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
319319
}
320320
}
321321

@@ -348,9 +348,9 @@ trait CompileTimeAssertions {
348348
case Literal(stringConst) =>
349349
val literalValue = stringConst.value.toString
350350
if (!isValid(literalValue))
351-
throw new TastyTypecheckError(notValidMsg)
351+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
352352
case _ =>
353-
throw new TastyTypecheckError(notLiteralMsg)
353+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
354354
}
355355
}
356356

@@ -383,9 +383,9 @@ trait CompileTimeAssertions {
383383
case Literal(charConst) =>
384384
val literalValue = charConst.value.toString.head
385385
if (!isValid(literalValue))
386-
throw new TastyTypecheckError(notValidMsg)
386+
throw new scala.tasty.reflect.ExprCastError(notValidMsg)
387387
case _ =>
388-
throw new TastyTypecheckError(notLiteralMsg)
388+
throw new scala.tasty.reflect.ExprCastError(notLiteralMsg)
389389
}
390390
}
391391
}

scalatest.dotty/src/main/scala/org/scalatest/AssertionsMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object AssertionsMacro {
5151
(implicit refl: Reflection): Expr[Assertion] = {
5252

5353
import refl._
54-
import quoted.Toolbox.Default._
54+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
5555

5656
val bool = BooleanMacro.parse(condition, prettifier)
5757
'{ ($helper)($bool, $clue, $pos) }

scalatest.dotty/src/main/scala/org/scalatest/CompileMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object CompileMacro {
2727
// parse and type check a code snippet, generate code to throw TestFailedException when type check passes or parse error
2828
def assertTypeErrorImpl(code: String, pos: Expr[source.Position])(implicit refl: Reflection): Expr[Assertion] = {
2929
import refl._
30-
import quoted.Toolbox.Default._
30+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
3131

3232
if (!typing.typeChecks(code)) '{ Succeeded }
3333
else '{

scalatest.dotty/src/main/scala/org/scalatest/DiagrammedAssertionsMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private[scalatest] object DiagrammedAssertionsMacro {
3131
prettifier: Expr[Prettifier],
3232
pos: Expr[source.Position])(implicit refl: Reflection): Expr[Assertion] = {
3333
import refl._
34-
import quoted.Toolbox.Default._
34+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
3535

3636
val startLine = refl.rootPosition.startLine // Get the expression first line number
3737
val endLine = refl.rootPosition.endLine // Get the expression last line number

scalatest.dotty/src/main/scala/org/scalatest/DiagrammedExprMacro.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object DiagrammedExprMacro {
3838
// Transform the input expression by parsing out the anchor and generate expression that can support diagram rendering
3939
def parse[T:Type](expr: Expr[T])(implicit refl: Reflection): Expr[DiagrammedExpr[T]] = {
4040
import refl._
41-
import quoted.Toolbox.Default._
41+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
4242

4343
def isXmlSugar(apply: Apply): Boolean = apply.tpe <:< typeOf[scala.xml.Elem]
4444
def isJavaStatic(tree: Tree): Boolean = tree.symbol.flags.is(Flags.Static)
@@ -54,42 +54,42 @@ object DiagrammedExprMacro {
5454
case IsSelect(x) if isJavaStatic(x) => simpleExpr(expr)
5555
case IsSelect(select) => selectExpr(expr) // delegate to selectExpr if it is a Select
5656
case Block(stats, expr) =>
57-
Block(stats, parse(expr.seal[T]).unseal).seal[DiagrammedExpr[T]] // call parse recursively using the expr argument if it is a block
57+
Block(stats, parse(expr.seal.cast[T]).unseal).seal.cast[DiagrammedExpr[T]] // call parse recursively using the expr argument if it is a block
5858
case _ => simpleExpr(expr) // for others, just delegate to simpleExpr
5959
}
6060
}
6161

6262
def applyExpr[T:Type](expr: Expr[T])(implicit refl: Reflection): Expr[DiagrammedExpr[T]] = {
6363
import refl._
64-
import quoted.Toolbox.Default._
64+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
6565

6666
def apply(l: Expr[_], name: String, r: List[Expr[_]]): Expr[T] =
67-
Select.overloaded(l.unseal, name, Nil, r.map(_.unseal)).seal[T]
67+
Select.overloaded(l.unseal, name, Nil, r.map(_.unseal)).seal.cast[T]
6868

6969
expr.unseal.underlyingArgument match {
7070
case Apply(Select(lhs, op), rhs :: Nil) =>
7171
op match {
7272
case "||" | "|" =>
73-
val left = parse(lhs.seal[T & Boolean])
74-
val right = parse(rhs.seal[T & Boolean])
73+
val left = parse(lhs.seal.cast[T & Boolean])
74+
val right = parse(rhs.seal.cast[T & Boolean])
7575
'{
7676
val l = $left
7777
val r = $right
7878
if (l.value) l
7979
else DiagrammedExpr.applyExpr(l, r :: Nil, r.value, ${ getAnchor(expr) })
8080
}
8181
case "&&" | "&" =>
82-
val left = parse(lhs.seal[T & Boolean])
83-
val right = parse(rhs.seal[T & Boolean])
82+
val left = parse(lhs.seal.cast[T & Boolean])
83+
val right = parse(rhs.seal.cast[T & Boolean])
8484
'{
8585
val l = $left
8686
val r = $right
8787
if (l.value) DiagrammedExpr.applyExpr(l, r :: Nil, r.value, ${ getAnchor(expr) })
8888
else l
8989
}
9090
case _ =>
91-
val left = parse(lhs.seal[Any])
92-
val right = parse(rhs.seal[Any])
91+
val left = parse(lhs.seal.cast[Any])
92+
val right = parse(rhs.seal.cast[Any])
9393
'{
9494
val l = $left
9595
val r = $right
@@ -98,8 +98,8 @@ object DiagrammedExprMacro {
9898
}
9999
}
100100
case Apply(Select(lhs, op), args) =>
101-
val left = parse(lhs.seal[Any])
102-
val rights = args.map(arg => parse(arg.seal[Any]))
101+
val left = parse(lhs.seal)
102+
val rights = args.map(arg => parse(arg.seal))
103103

104104
let(left) { (l: Expr[DiagrammedExpr[_]]) =>
105105
lets(rights) { (rs: List[Expr[DiagrammedExpr[_]]]) =>
@@ -114,13 +114,13 @@ object DiagrammedExprMacro {
114114

115115
def selectExpr[T:Type](expr: Expr[T])(implicit refl: Reflection): Expr[DiagrammedExpr[T]] = {
116116
import refl._
117-
import quoted.Toolbox.Default._
117+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
118118

119119
def selectField(o: Expr[_], name: String): Expr[T] = ???
120120

121121
expr.unseal match {
122122
case Select(qual, name) =>
123-
val obj = parse(qual.seal[Any])
123+
val obj = parse(qual.seal)
124124

125125
'{
126126
val o = $obj
@@ -147,7 +147,7 @@ object DiagrammedExprMacro {
147147

148148
def getAnchor(expr: Expr[_])(implicit refl: Reflection): Expr[Int] = {
149149
import refl._
150-
import quoted.Toolbox.Default._
150+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
151151
(expr.unseal.pos.endColumn - expr.unseal.pos.startColumn).toExpr
152152
}
153153
}

scalatest.dotty/src/main/scala/org/scalatest/ExpectationsMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private[scalatest] object ExpectationsMacro {
2626

2727
def expect(condition: Expr[Boolean])(prettifier: Expr[Prettifier], pos: Expr[source.Position])(implicit refl: Reflection): Expr[Fact] = {
2828
import refl._
29-
import quoted.Toolbox.Default._
29+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
3030

3131
val bool = BooleanMacro.parse(condition, prettifier)
3232
'{ Expectations.expectationsHelper.macroExpect($bool, "", $prettifier, $pos) }

scalatest.dotty/src/main/scala/org/scalatest/matchers/MatchPatternMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ private[scalatest] object MatchPatternMacro {
7272

7373
def andNotMatchPatternMatcher[T:Type](self: Expr[Matcher[T]#AndNotWord], right: Expr[PartialFunction[Any, _]])(implicit refl: Reflection): Expr[Matcher[T]] = {
7474
import refl._
75-
import quoted.Toolbox.Default._
75+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
7676

7777
val notMatcher = '{ MatchPatternHelper.notMatchPatternMatcher($right) }
7878
'{ ($self).owner.and($notMatcher) }
7979
}
8080

8181
def orNotMatchPatternMatcher[T:Type](self: Expr[Matcher[T]#OrNotWord], right: Expr[PartialFunction[Any, _]])(implicit refl: Reflection): Expr[Matcher[T]] = {
8282
import refl._
83-
import quoted.Toolbox.Default._
83+
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
8484

8585
val notMatcher = '{ MatchPatternHelper.notMatchPatternMatcher($right) }
8686
'{ ($self).owner.or($notMatcher) }

0 commit comments

Comments
 (0)