Skip to content

Commit b4bcec1

Browse files
committed
Removed unnecessary implicit toolbox lines as advised by @liufengyun .
1 parent 99fdfed commit b4bcec1

File tree

7 files changed

+18
-38
lines changed

7 files changed

+18
-38
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +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-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
237-
236+
238237
val bool = BooleanMacro.parse(condition, prettifier)
239238
'{ Requirements.requirementsHelper.macroRequire($bool, $clue) }
240239
}
@@ -248,8 +247,7 @@ object RequirementsMacro {
248247
*/
249248
def requireState(condition: Expr[Boolean], prettifier: Expr[Prettifier], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = {
250249
import refl._
251-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
252-
250+
253251
val bool = BooleanMacro.parse(condition, prettifier)
254252
'{ Requirements.requirementsHelper.macroRequireState($bool, $clue) }
255253
}

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

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

5353
import refl._
54-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
55-
54+
5655
val bool = BooleanMacro.parse(condition, prettifier)
5756
'{ ($helper)($bool, $clue, $pos) }
5857
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +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-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
31-
30+
3231
if (!typing.typeChecks(code)) '{ Succeeded }
3332
else '{
3433
val messageExpr = Resources.expectedCompileErrorButGotNone(${ code.toExpr })

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +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-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
42-
41+
4342
def isXmlSugar(apply: Apply): Boolean = apply.tpe <:< typeOf[scala.xml.Elem]
4443
def isJavaStatic(tree: Tree): Boolean = tree.symbol.flags.is(Flags.Static)
4544

@@ -61,8 +60,7 @@ object DiagrammedExprMacro {
6160

6261
def applyExpr[T:Type](expr: Expr[T])(implicit refl: Reflection): Expr[DiagrammedExpr[T]] = {
6362
import refl._
64-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
65-
63+
6664
def apply(l: Expr[_], name: String, r: List[Expr[_]]): Expr[T] =
6765
Select.overloaded(l.unseal, name, Nil, r.map(_.unseal)).seal.cast[T]
6866

@@ -114,8 +112,7 @@ object DiagrammedExprMacro {
114112

115113
def selectExpr[T:Type](expr: Expr[T])(implicit refl: Reflection): Expr[DiagrammedExpr[T]] = {
116114
import refl._
117-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
118-
115+
119116
def selectField(o: Expr[_], name: String): Expr[T] = ???
120117

121118
expr.unseal match {
@@ -147,7 +144,6 @@ object DiagrammedExprMacro {
147144

148145
def getAnchor(expr: Expr[_])(implicit refl: Reflection): Expr[Int] = {
149146
import refl._
150-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
151147
(expr.unseal.pos.endColumn - expr.unseal.pos.startColumn).toExpr
152148
}
153149
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ 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-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
3029

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

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,14 @@ 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-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
76-
75+
7776
val notMatcher = '{ MatchPatternHelper.notMatchPatternMatcher($right) }
7877
'{ ($self).owner.and($notMatcher) }
7978
}
8079

8180
def orNotMatchPatternMatcher[T:Type](self: Expr[Matcher[T]#OrNotWord], right: Expr[PartialFunction[Any, _]])(implicit refl: Reflection): Expr[Matcher[T]] = {
8281
import refl._
83-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
84-
82+
8583
val notMatcher = '{ MatchPatternHelper.notMatchPatternMatcher($right) }
8684
'{ ($self).owner.or($notMatcher) }
8785
}

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

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ private[scalatest] object TypeMatcherMacro {
2929
// // Check that no type parameter is specified, if any does, give a friendly compiler warning.
3030
def checkTypeParameter(refl: Reflection)(tree: refl.Term, methodName: String): Unit = {
3131
import refl._
32-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
33-
32+
3433
// TODO#Macros: Select lack unapply
3534
/*
3635
tree.underlyingArgument match {
@@ -52,8 +51,7 @@ private[scalatest] object TypeMatcherMacro {
5251
// Do checking on type parameter and generate AST that create a 'a type' matcher
5352
def aTypeMatcherImpl(aType: Expr[ResultOfATypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[Any]] = {
5453
import refl._
55-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
56-
54+
5755
// check type parameter
5856
checkTypeParameter(refl)(aType.unseal, "a")
5957

@@ -68,8 +66,7 @@ private[scalatest] object TypeMatcherMacro {
6866
// Do checking on type parameter and generate AST that create a 'an type' matcher
6967
def anTypeMatcherImpl(anType: Expr[ResultOfAnTypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[Any]] = {
7068
import refl._
71-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
72-
69+
7370
// check type parameter
7471
checkTypeParameter(refl)(anType.unseal, "an")
7572

@@ -84,8 +81,7 @@ private[scalatest] object TypeMatcherMacro {
8481
// Do checking on type parameter and generate AST that create a negated 'a type' matcher
8582
def notATypeMatcher(aType: Expr[ResultOfATypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[Any]] = {
8683
import refl._
87-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
88-
84+
8985
// check type parameter
9086
checkTypeParameter(refl)(aType.unseal, "a")
9187

@@ -100,8 +96,7 @@ private[scalatest] object TypeMatcherMacro {
10096
// Do checking on type parameter and generate AST that create a negated 'an type' matcher
10197
def notAnTypeMatcher(anType: Expr[ResultOfAnTypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[Any]] = {
10298
import refl._
103-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
104-
99+
105100
// check type parameter
106101
checkTypeParameter(refl)(anType.unseal, "an")
107102

@@ -116,8 +111,7 @@ private[scalatest] object TypeMatcherMacro {
116111
// Do checking on type parameter and generate AST that does a 'and not' logical expression matcher for 'a type' matcher.
117112
def andNotATypeMatcher[T:Type](self: Expr[Matcher[T]#AndNotWord], aType: Expr[ResultOfATypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[T]] = {
118113
import refl._
119-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
120-
114+
121115
// create a negated matcher from notATypeMatcher
122116
val rhs = notATypeMatcher(aType)
123117

@@ -132,8 +126,7 @@ private[scalatest] object TypeMatcherMacro {
132126
// Do checking on type parameter and generate AST that does a 'and not' logical expression matcher for 'an type' matcher.
133127
def andNotAnTypeMatcher[T:Type](self: Expr[Matcher[T]#AndNotWord], anType: Expr[ResultOfAnTypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[T]] = {
134128
import refl._
135-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
136-
129+
137130
// create a negated matcher from notAnTypeMatcher
138131
val rhs = notAnTypeMatcher(anType)
139132

@@ -148,8 +141,7 @@ private[scalatest] object TypeMatcherMacro {
148141
// Do checking on type parameter and generate AST that does a 'or not' logical expression matcher for 'a type' matcher.
149142
def orNotATypeMatcher[T:Type](self: Expr[Matcher[T]#OrNotWord], aType: Expr[ResultOfATypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[T]] = {
150143
import refl._
151-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
152-
144+
153145
// create a negated matcher from notATypeMatcher
154146
val rhs = notATypeMatcher(aType)
155147

@@ -164,8 +156,7 @@ private[scalatest] object TypeMatcherMacro {
164156
// Do checking on type parameter and generate AST that does a 'or not' logical expression matcher for 'an type' matcher.
165157
def orNotAnTypeMatcher[T:Type](self: Expr[Matcher[T]#OrNotWord], anType: Expr[ResultOfAnTypeInvocation[_]])(implicit refl: Reflection): Expr[Matcher[T]] = {
166158
import refl._
167-
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader)
168-
159+
169160
// create a negated matcher from notAnTypeMatcher
170161
val rhs = notAnTypeMatcher(anType)
171162

0 commit comments

Comments
 (0)