Skip to content

Commit f8944de

Browse files
committed
Remove deprecated method calls
1 parent 1df03ed commit f8944de

File tree

10 files changed

+62
-62
lines changed

10 files changed

+62
-62
lines changed

dotty/diagrams/src/main/scala/org/scalatest/diagrams/DiagramsMacro.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ object DiagramsMacro {
3939
def selectField(o: Term, name: String): Term = Select.unique(o, name)
4040

4141
def default(term: Term): Term = term.asExpr match {
42-
case '{ $x: t } => Term.of('{ DiagrammedExpr.simpleExpr[t]($x, ${ getAnchor(term) } ) })
42+
case '{ $x: t } => '{ DiagrammedExpr.simpleExpr[t]($x, ${ getAnchor(term) } ) }.asTerm
4343
}
4444

4545
def getAnchorForSelect(sel: Select): Expr[Int] = {
@@ -53,7 +53,7 @@ object DiagramsMacro {
5353

5454
def getAnchor(expr: Term): Expr[Int] = {
5555
// -1 to match scala2 position
56-
// Expr((Term.of(expr).pos.endColumn + Term.of(expr).pos.startColumn - 1) / 2 - Position.ofMacroExpansion.startColumn)
56+
// Expr((expr.asTerm.pos.endColumn + expr.asTerm.pos.startColumn - 1) / 2 - Position.ofMacroExpansion.startColumn)
5757
Expr(expr.pos.startColumn - Position.ofMacroExpansion.startColumn)
5858
}
5959

@@ -85,10 +85,10 @@ object DiagramsMacro {
8585
parse(qual).asExpr match {
8686
case '{ $obj: DiagrammedExpr[t] } =>
8787
val anchor = getAnchorForSelect(sel)
88-
Term.of('{
88+
'{
8989
val o = $obj
90-
DiagrammedExpr.selectExpr[r](o, ${ selectField(Term.of('{o.value}), name).asExprOf[r] }, $anchor)
91-
})
90+
DiagrammedExpr.selectExpr[r](o, ${ selectField('{o.value}.asTerm, name).asExprOf[r] }, $anchor)
91+
}.asTerm
9292
}
9393

9494
case Block(stats, expr) =>
@@ -101,25 +101,25 @@ object DiagramsMacro {
101101
val left = parse(lhs).asExprOf[DiagrammedExpr[Boolean]]
102102
val right = parse(rhs).asExprOf[DiagrammedExpr[Boolean]]
103103

104-
Term.of('{
104+
'{
105105
val l = $left
106106
if (l.value) l
107107
else {
108108
val r = $right
109109
DiagrammedExpr.applyExpr[Boolean](l, r :: Nil, r.value, $anchor)
110110
}
111-
})
111+
}.asTerm
112112
case "&&" | "&" =>
113113
val left = parse(lhs).asExprOf[DiagrammedExpr[Boolean]]
114114
val right = parse(rhs).asExprOf[DiagrammedExpr[Boolean]]
115-
Term.of('{
115+
'{
116116
val l = $left
117117
if (!l.value) l
118118
else {
119119
val r = $right
120120
DiagrammedExpr.applyExpr[Boolean](l, r :: Nil, r.value, $anchor)
121121
}
122-
})
122+
}.asTerm
123123
case _ =>
124124
val left = parse(lhs)
125125

@@ -132,7 +132,7 @@ object DiagramsMacro {
132132
case '{ $left: DiagrammedExpr[t] } =>
133133
val rights = rs.map(_.asExprOf[DiagrammedExpr[_]])
134134
val res = Select.unique(l, "value").select(sel.symbol).appliedToArgs(diagrams.map(r => Select.unique(r, "value")) ++ others).asExprOf[r]
135-
Term.of('{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) })
135+
'{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) }.asTerm
136136
}
137137
}
138138
}
@@ -151,7 +151,7 @@ object DiagramsMacro {
151151
case '{ $left: DiagrammedExpr[t] } =>
152152
val rights = rs.map(_.asExprOf[DiagrammedExpr[_]])
153153
val res = Select.unique(l, "value").select(sel.symbol).appliedToArgs(diagrams.map(r => Select.unique(r, "value")) ++ others).asExprOf[r]
154-
Term.of('{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) })
154+
'{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) }.asTerm
155155
}
156156
}
157157
}
@@ -170,7 +170,7 @@ object DiagramsMacro {
170170
val l = left.asExprOf[DiagrammedExpr[_]]
171171
val r = right.asExprOf[DiagrammedExpr[_]]
172172
val b = result.asExprOf[Boolean]
173-
Term.of('{ DiagrammedExpr.applyExpr[Boolean]($l, $r :: Nil, $b, $anchor) })
173+
'{ DiagrammedExpr.applyExpr[Boolean]($l, $r :: Nil, $b, $anchor) }.asTerm
174174
}
175175
}
176176
}
@@ -189,7 +189,7 @@ object DiagramsMacro {
189189
val rights = rs.map(_.asExprOf[DiagrammedExpr[_]])
190190
val res = Select.unique(l, "value").select(sel.symbol).appliedToTypes(targs.map(_.tpe))
191191
.appliedToArgs(diagrams.map(r => Select.unique(r, "value")) ++ others).asExprOf[r]
192-
Term.of('{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) })
192+
'{ DiagrammedExpr.applyExpr[r]($left, ${Expr.ofList(rights)}, $res, $anchor) }.asTerm
193193
}
194194
}
195195
}
@@ -202,7 +202,7 @@ object DiagramsMacro {
202202
l.asExpr match {
203203
case '{ $left: DiagrammedExpr[t] } =>
204204
val res = Select.unique(l, "value").select(sel.symbol).appliedToTypes(targs.map(_.tpe)).asExprOf[r]
205-
Term.of('{ DiagrammedExpr.applyExpr[r]($left, Nil, $res, $anchor) })
205+
'{ DiagrammedExpr.applyExpr[r]($left, Nil, $res, $anchor) }.asTerm
206206
}
207207
}
208208

@@ -217,7 +217,7 @@ object DiagramsMacro {
217217
condition: Expr[Boolean], pos: Expr[source.Position], clue: Expr[Any], sourceText: String
218218
)(using Quotes): Expr[Assertion] = {
219219
import quotes.reflect._
220-
val diagExpr = parse(Term.of(condition).underlyingArgument).asExprOf[DiagrammedExpr[Boolean]]
220+
val diagExpr = parse(condition.asTerm.underlyingArgument).asExprOf[DiagrammedExpr[Boolean]]
221221
'{ $helper($diagExpr, $clue, ${Expr(sourceText)}, $pos) }
222222
}
223223
}

dotty/matchers-core/src/main/scala/org/scalatest/matchers/CompileMacro.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object CompileMacro {
3636
throw new TestFailedException((_: StackDepthException) => Some(messageExpr), None, $pos)
3737
}
3838

39-
Term.of(self).underlyingArgument match {
39+
self.asTerm.underlyingArgument match {
4040

4141
case Apply(
4242
Apply(
@@ -79,7 +79,7 @@ object CompileMacro {
7979
throw new TestFailedException((_: StackDepthException) => Some(messageExpr), None, $pos)
8080
}
8181

82-
Term.of(self).underlyingArgument match {
82+
self.asTerm.underlyingArgument match {
8383

8484
case Apply(
8585
Apply(
@@ -123,7 +123,7 @@ object CompileMacro {
123123

124124
val methodName = shouldOrMust + "Not"
125125

126-
Term.of(self).underlyingArgument match {
126+
self.asTerm.underlyingArgument match {
127127
case Apply(
128128
Apply(
129129
Select(_, shouldOrMustTerconvertToStringShouldOrMustWrapperTermName),

dotty/matchers-core/src/main/scala/org/scalatest/matchers/TypeMatcherMacro.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object TypeMatcherMacro {
5252
import quotes.reflect._
5353

5454
// check type parameter
55-
checkTypeParameter(Term.of(aType), "a")
55+
checkTypeParameter(aType.asTerm, "a")
5656

5757
/**
5858
* Generate AST that does the following code:
@@ -67,7 +67,7 @@ object TypeMatcherMacro {
6767
import quotes.reflect._
6868

6969
// check type parameter
70-
checkTypeParameter(Term.of(anType), "an")
70+
checkTypeParameter(anType.asTerm, "an")
7171

7272
/**
7373
* Generate AST that does the following code:
@@ -82,7 +82,7 @@ object TypeMatcherMacro {
8282
import quotes.reflect._
8383

8484
// check type parameter
85-
checkTypeParameter(Term.of(aType), "a")
85+
checkTypeParameter(aType.asTerm, "a")
8686

8787
/**
8888
* Generate AST that does the following code:
@@ -97,7 +97,7 @@ object TypeMatcherMacro {
9797
import quotes.reflect._
9898

9999
// check type parameter
100-
checkTypeParameter(Term.of(anType), "an")
100+
checkTypeParameter(anType.asTerm, "an")
101101

102102
/**
103103
* Generate AST that does the following code:
@@ -207,7 +207,7 @@ object TypeMatcherMacro {
207207
// Do checking on type parameter and generate AST to call TypeMatcherHelper.assertATypeShouldBeTrue
208208
def assertATypeShouldBeTrueImpl(self: Expr[ResultOfNotWordForAny[_]], aType: Expr[ResultOfATypeInvocation[_]])(using Quotes): Expr[org.scalatest.Assertion] = {
209209
import quotes.reflect._
210-
checkTypeParameter(Term.of(aType), "a")
210+
checkTypeParameter(aType.asTerm, "a")
211211
'{
212212
TypeMatcherHelper.assertATypeShouldBeTrue(($self).left, $aType, ($self).shouldBeTrue, ($self).prettifier, ($self).pos)
213213
}
@@ -216,7 +216,7 @@ object TypeMatcherMacro {
216216
// Do checking on type parameter and generate AST to call TypeMatcherHelper.assertAnTypeShouldBeTrue
217217
def assertAnTypeShouldBeTrueImpl(self: Expr[ResultOfNotWordForAny[_]], anType: Expr[ResultOfAnTypeInvocation[_]])(using Quotes): Expr[org.scalatest.Assertion] = {
218218
import quotes.reflect._
219-
checkTypeParameter(Term.of(anType), "an")
219+
checkTypeParameter(anType.asTerm, "an")
220220
'{
221221
TypeMatcherHelper.assertAnTypeShouldBeTrue(($self).left, $anType, ($self).shouldBeTrue, ($self).prettifier, ($self).pos)
222222
}

dotty/mustmatchers/src/main/scala/org/scalatest/matchers/must/TypeMatcherMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object TypeMatcherMacro {
5050
// Do checking on type parameter and generate AST to call TypeMatcherHelper.checkAType, used by 'mustBe a [type]' syntax
5151
def mustBeATypeImpl(self: Expr[org.scalatest.matchers.must.Matchers#AnyMustWrapper[_]], aType: Expr[ResultOfATypeInvocation[_]])(using Quotes): Expr[org.scalatest.Assertion] = {
5252
import quotes.reflect._
53-
checkTypeParameter(Term.of(aType), "a")
53+
checkTypeParameter(aType.asTerm, "a")
5454
'{
5555
org.scalatest.matchers.TypeMatcherHelper.assertAType(($self).leftSideValue, $aType, ($self).prettifier, ($self).pos)
5656
}
@@ -59,7 +59,7 @@ object TypeMatcherMacro {
5959
// Do checking on type parameter and generate AST to call TypeMatcherHelper.checkAnType, used by 'mustBe an [type]' syntax
6060
def mustBeAnTypeImpl(self: Expr[org.scalatest.matchers.must.Matchers#AnyMustWrapper[_]], anType: Expr[ResultOfAnTypeInvocation[_]])(using Quotes): Expr[org.scalatest.Assertion] = {
6161
import quotes.reflect._
62-
checkTypeParameter(Term.of(anType), "an")
62+
checkTypeParameter(anType.asTerm, "an")
6363
'{
6464
org.scalatest.matchers.TypeMatcherHelper.assertAnType(($self).leftSideValue, $anType, ($self).prettifier, ($self).pos)
6565
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ object BooleanMacro {
8282
}
8383
}
8484

85-
Term.of(condition).underlyingArgument match {
85+
condition.asTerm.underlyingArgument match {
8686
case Apply(sel @ Select(Apply(qual, lhs :: Nil), op @ ("===" | "!==")), rhs :: Nil) =>
8787
let(Symbol.spliceOwner, lhs) { left =>
8888
let(Symbol.spliceOwner, rhs) { right =>
@@ -91,7 +91,7 @@ object BooleanMacro {
9191
val r = right.asExpr
9292
val b = result.asExprOf[Boolean]
9393
val code = '{ Bool.binaryMacroBool($l, ${ Expr(op) }, $r, $b, $prettifier) }
94-
Term.of(code)
94+
code.asTerm
9595
}
9696
}
9797
}.asExprOf[Bool]
@@ -108,7 +108,7 @@ object BooleanMacro {
108108
val r = right.asExpr
109109
val b = result.asExprOf[Boolean]
110110
val code = '{ Bool.binaryMacroBool($l, ${Expr(op)}, $r, $b, $prettifier) }
111-
Term.of(code)
111+
code.asTerm
112112
}
113113
}
114114
}.asExprOf[Bool]
@@ -142,7 +142,7 @@ object BooleanMacro {
142142
val r = right.asExpr
143143
val res = result.asExpr
144144
val code = '{ Bool.lengthSizeMacroBool($l, ${Expr(op)}, $res, $r, $prettifier) }
145-
Term.of(code)
145+
code.asTerm
146146
}
147147
}
148148
}.asExprOf[Bool]
@@ -156,7 +156,7 @@ object BooleanMacro {
156156
val r = right.asExpr
157157
val res = result.asExpr
158158
val code = '{ Bool.lengthSizeMacroBool($l, ${Expr(op)}, $res, $r, $prettifier) }
159-
Term.of(code)
159+
code.asTerm
160160
}
161161
}
162162
}.asExprOf[Bool]
@@ -174,7 +174,7 @@ object BooleanMacro {
174174
val r = rhsInner.asExpr
175175
val res = result.asExprOf[Boolean]
176176
val code = '{ Bool.existsMacroBool($l, $r, $res, $prettifier) }
177-
Term.of(code)
177+
code.asTerm
178178
}
179179
}.asExprOf[Bool]
180180
case _ => defaultCase
@@ -193,7 +193,7 @@ object BooleanMacro {
193193
val r = right.asExpr
194194
val b = result.asExprOf[Boolean]
195195
val code = '{ Bool.binaryMacroBool($l, ${ Expr(op) }, $r, $b, $prettifier) }
196-
Term.of(code)
196+
code.asTerm
197197
}
198198
}
199199
}.asExprOf[Bool]
@@ -207,15 +207,15 @@ object BooleanMacro {
207207
val r = right.asExpr
208208
val b = result.asExprOf[Boolean]
209209
val code = '{ Bool.binaryMacroBool($l, ${Expr(op)}, $r, $b, $prettifier) }
210-
Term.of(code)
210+
code.asTerm
211211
}
212212
}
213213
}.asExprOf[Bool]
214214

215215
case Apply(sel @ Select(lhs, op @ ("isEmpty" | "nonEmpty")), Nil) =>
216216
let(Symbol.spliceOwner, lhs) { l =>
217217
val res = l.select(sel.symbol).appliedToArgs(Nil).asExprOf[Boolean]
218-
Term.of('{ Bool.unaryMacroBool(${l.asExpr}, ${ Expr(op) }, $res, $prettifier) })
218+
'{ Bool.unaryMacroBool(${l.asExpr}, ${ Expr(op) }, $res, $prettifier) }.asTerm
219219
}.asExprOf[Bool]
220220

221221
case Select(left, "unary_!") =>
@@ -225,14 +225,14 @@ object BooleanMacro {
225225
case sel @ Select(left, op @ ("isEmpty" | "nonEmpty")) =>
226226
let(Symbol.spliceOwner, left) { l =>
227227
val res = l.select(sel.symbol).asExprOf[Boolean]
228-
Term.of('{ Bool.unaryMacroBool(${l.asExpr}, ${ Expr(op) }, $res, $prettifier) })
228+
'{ Bool.unaryMacroBool(${l.asExpr}, ${ Expr(op) }, $res, $prettifier) }.asTerm
229229
}.asExprOf[Bool]
230230

231231
case TypeApply(sel @ Select(lhs, "isInstanceOf"), targs) =>
232232
let(Symbol.spliceOwner, lhs) { l =>
233233
val res = l.select(sel.symbol).appliedToTypeTrees(targs).asExprOf[Boolean]
234234
val name = Expr(targs.head.tpe.show)
235-
Term.of('{ Bool.isInstanceOfMacroBool(${l.asExpr}, "isInstanceOf", $name, $res, $prettifier) })
235+
'{ Bool.isInstanceOfMacroBool(${l.asExpr}, "isInstanceOf", $name, $res, $prettifier) }.asTerm
236236
}.asExprOf[Bool]
237237

238238
case Literal(_) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ object RequirementsMacro {
262262
case Nil => '{ Seq(): Seq[String] }
263263
}
264264

265-
val argStr: List[Expr[String]] = Term.of(arguments).underlyingArgument match {
265+
val argStr: List[Expr[String]] = arguments.asTerm.underlyingArgument match {
266266
case Typed(Repeated(args, _), _) => // only sequence literal
267267
args.map(arg => Expr(arg.asExprOf[Any].show))
268268
case _ =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ object SnapshotsMacro {
228228
case Nil => '{ Seq(): Seq[Snapshot] }
229229
}
230230

231-
val snapshots: List[Expr[Snapshot]] = Term.of(expressions).underlyingArgument match {
231+
val snapshots: List[Expr[Snapshot]] = expressions.asTerm.underlyingArgument match {
232232
case Typed(Repeated(args, _), _) => // only sequence literal
233233
args.map { arg =>
234234
val str = Expr(arg.asExpr.show)

0 commit comments

Comments
 (0)