Skip to content

Commit 856d742

Browse files
nicolasstuckicheeseng
authored andcommitted
Use given imports
1 parent 14c5d4d commit 856d742

File tree

18 files changed

+48
-48
lines changed

18 files changed

+48
-48
lines changed

common-test.dotty/src/main/scala/org/scalatest/LineNumberHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private[scalatest] trait LineNumberHelper {
99

1010
object LineNumberMacro {
1111
def thisLineNumberImpl(implicit qctx: QuoteContext): Expr[Int] = {
12-
import qctx.tasty._
12+
import qctx.tasty.{_, given}
1313
Expr(rootPosition.startLine)
1414
}
1515
}

project/GenAnyVals.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object GenAnyVals {
3232
| def apply(value: Expr[$primitiveTypeName])(implicit qctx: QuoteContext): Expr[$typeName] = {
3333
| val notValidMsg = Resources.notValid$typeName
3434
| val notLiteralMsg = Resources.notLiteral$typeName
35-
| import qctx.tasty._
35+
| import qctx.tasty.{_, given}
3636
| ensureValid${primitiveTypeName}Literal(value, notValidMsg, notLiteralMsg)(isValid)
3737
| '{ $typeName.ensuringValid($$value) }
3838
| }
@@ -636,7 +636,7 @@ object GenAnyVals {
636636
|def plus(x: $typePrefix2$primitiveName): $typePrefix$primitiveName = $typePrefix$primitiveName.ensuringValid(value + x.value)
637637
|""".stripMargin
638638

639-
def deprecatedOrdering(name: String, typePrefix: String, primitiveName: String): String =
639+
def deprecatedOrdering(name: String, typePrefix: String, primitiveName: String): String =
640640
s"""
641641
|/**
642642
| * <strong>The formerly implicit <code>$name</code> field has been deprecated and will be removed in a future version of ScalaTest. Please use the <code>ordering</code> field instead.</strong>
@@ -646,7 +646,7 @@ object GenAnyVals {
646646
| new Ordering[$typePrefix$primitiveName] {
647647
| def compare(x: $typePrefix$primitiveName, y: $typePrefix$primitiveName): Int = ordering.compare(x, y)
648648
| }
649-
""".stripMargin
649+
""".stripMargin
650650

651651
def importsForMacro(dotty: Boolean): String =
652652
if (dotty)
@@ -705,7 +705,7 @@ object GenAnyVals {
705705
isPosInfinity("PosZ", "Float") +
706706
isFinite("PosZ", "Float"),
707707
positiveInfinity("PosZ", "Float") +
708-
minPositiveValue("PosZ", "Float") +
708+
minPositiveValue("PosZ", "Float") +
709709
deprecatedOrdering("posZFloatOrd", "PosZ", "Float"),
710710
posZWidens("Float"), dotty) :::
711711
genDoubleAnyVal(dir, "PosZDouble", "non-negative", "", "i >= 0.0", "PosZDouble(1.1)", "PosZDouble(-1.1)", "1.1", "-1.1", "0.0", "0.0",
@@ -717,7 +717,7 @@ object GenAnyVals {
717717
isPosInfinity("PosZ", "Double") +
718718
isFinite("PosZ", "Double"),
719719
positiveInfinity("PosZ", "Double") +
720-
minPositiveValue("PosZ", "Double") +
720+
minPositiveValue("PosZ", "Double") +
721721
deprecatedOrdering("posZDoubleOrd", "PosZ", "Double"),
722722
posZWidens("Double"), dotty) :::
723723
genIntAnyVal(dir, "PosInt", "positive", "Note: a <code>PosInt</code> may not equal 0. If you want positive number or 0, use [[PosZInt]].", "i > 0", "PosInt(42)", "PosInt(0)", "42", "0", "1", "1",
@@ -733,7 +733,7 @@ object GenAnyVals {
733733
isPosInfinity("Pos", "Float") +
734734
isFinite("Pos", "Float"),
735735
positiveInfinity("Pos", "Float") +
736-
minPositiveValue("Pos", "Float") +
736+
minPositiveValue("Pos", "Float") +
737737
deprecatedOrdering("posFloatOrd", "Pos", "Float"),
738738
posWidens("Float"), dotty) :::
739739
genDoubleAnyVal(dir, "PosDouble", "positive", "", "i > 0.0", "PosDouble(1.1)", "PosDouble(-1.1)", "1.1", "-1.1", "Double.MinPositiveValue", "4.9E-324",
@@ -745,7 +745,7 @@ object GenAnyVals {
745745
isPosInfinity("Pos", "Double") +
746746
isFinite("Pos", "Double"),
747747
positiveInfinity("Pos", "Double") +
748-
minPositiveValue("Pos", "Double") +
748+
minPositiveValue("Pos", "Double") +
749749
deprecatedOrdering("posDoubleOrd", "Pos", "Double"),
750750
posWidens("Double"), dotty) :::
751751
genIntAnyVal(dir, "NegInt", "negative", "Note: a <code>NegInt</code> may not equal 0. If you want negative number or 0, use [[NegZInt]].", "i < 0", "NegInt(-42)", "NegInt(0)", "-42", "0", "Int.MinValue", "-2147483648", "-1", "-1",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object BooleanMacro {
3838
"exists") ++ logicOperators
3939

4040
def parse(condition: Expr[Boolean], prettifier: Expr[Prettifier])(implicit qctx: QuoteContext): Expr[Bool] = {
41-
import qctx.tasty._
41+
import qctx.tasty.{_, given}
4242
import util._
4343

4444
def exprStr: String = condition.show

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ object RequirementsMacro {
231231
* @return transformed expression that performs the requirement check and throw <code>IllegalArgumentException</code> with rich error message if requirement failed
232232
*/
233233
def require(condition: Expr[Boolean], prettifier: Expr[Prettifier], clue: Expr[Any])(implicit qctx: QuoteContext): Expr[Unit] = {
234-
import qctx.tasty._
234+
import qctx.tasty.{_, given}
235235

236236
val bool = BooleanMacro.parse(condition, prettifier)
237237
'{ Requirements.requirementsHelper.macroRequire($bool, $clue) }
@@ -245,7 +245,7 @@ object RequirementsMacro {
245245
* @return transformed expression that performs the requirement check and throw <code>IllegalStateException</code> with rich error message if requirement failed
246246
*/
247247
def requireState(condition: Expr[Boolean], prettifier: Expr[Prettifier], clue: Expr[Any])(implicit qctx: QuoteContext): Expr[Unit] = {
248-
import qctx.tasty._
248+
import qctx.tasty.{_, given}
249249

250250
val bool = BooleanMacro.parse(condition, prettifier)
251251
'{ Requirements.requirementsHelper.macroRequireState($bool, $clue) }
@@ -259,7 +259,7 @@ object RequirementsMacro {
259259
* @return transformed expression that performs the requirement check and throw <code>NullArgumentException</code> with rich error message if requirement failed
260260
*/
261261
def requireNonNull(arguments: Expr[Seq[Any]], prettifier: Expr[Prettifier], pos: Expr[source.Position])(implicit qctx: QuoteContext): Expr[Unit] = {
262-
import qctx.tasty._
262+
import qctx.tasty.{_, given}
263263

264264
def liftSeq(args: Seq[Expr[String]]): Expr[Seq[String]] = args match {
265265
case x :: xs => '{ ($x) +: ${ liftSeq(xs) } }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ object Snapshots extends Snapshots
221221
object SnapshotsMacro {
222222

223223
def snap(expressions: Expr[Seq[Any]])(implicit qctx: QuoteContext): Expr[SnapshotSeq] = {
224-
import qctx.tasty._
224+
import qctx.tasty.{_, given}
225225

226226
def liftSeq(args: Seq[Expr[Snapshot]]): Expr[Seq[Snapshot]] = args match {
227227
case x :: xs => '{ ($x) +: ${ liftSeq(xs) } }

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ trait CompileTimeAssertions {
201201
* @param isValid a function used to validate a literal value parsed from the given expression
202202
*/
203203
def ensureValidIntLiteral(value: Expr[Int], notValidMsg: String, notLiteralMsg: String)(isValid: Int => Boolean)(implicit qctx: QuoteContext): Unit = {
204-
import qctx.tasty._
204+
import qctx.tasty.{_, given}
205205

206206
value.unseal.underlyingArgument match {
207207
case Literal(intConst) =>
@@ -236,7 +236,7 @@ trait CompileTimeAssertions {
236236
* @param isValid a function used to validate a literal value parsed from the given expression
237237
*/
238238
def ensureValidLongLiteral(value: Expr[Long], notValidMsg: String, notLiteralMsg: String)(isValid: Long => Boolean)(implicit qctx: QuoteContext): Unit = {
239-
import qctx.tasty._
239+
import qctx.tasty.{_, given}
240240

241241
value.unseal.underlyingArgument match {
242242
case Literal(longConst) =>
@@ -271,7 +271,7 @@ trait CompileTimeAssertions {
271271
* @param isValid a function used to validate a literal value parsed from the given expression
272272
*/
273273
def ensureValidFloatLiteral(value: Expr[Float], notValidMsg: String, notLiteralMsg: String)(isValid: Float => Boolean)(implicit qctx: QuoteContext): Unit = {
274-
import qctx.tasty._
274+
import qctx.tasty.{_, given}
275275

276276
value.unseal.underlyingArgument match {
277277
case Literal(floatConst) =>
@@ -306,7 +306,7 @@ trait CompileTimeAssertions {
306306
* @param isValid a function used to validate a literal value parsed from the given expression
307307
*/
308308
def ensureValidDoubleLiteral(value: Expr[Double], notValidMsg: String, notLiteralMsg: String)(isValid: Double => Boolean)(implicit qctx: QuoteContext): Unit = {
309-
import qctx.tasty._
309+
import qctx.tasty.{_, given}
310310

311311
value.unseal.underlyingArgument match {
312312
case Literal(doubleConst) =>
@@ -341,7 +341,7 @@ trait CompileTimeAssertions {
341341
* @param isValid a function used to validate a literal value parsed from the given expression
342342
*/
343343
def ensureValidStringLiteral(value: Expr[String], notValidMsg: String, notLiteralMsg: String)(isValid: String => Boolean)(implicit qctx: QuoteContext): Unit = {
344-
import qctx.tasty._
344+
import qctx.tasty.{_, given}
345345

346346
value.unseal.underlyingArgument match {
347347
case Literal(stringConst) =>
@@ -376,7 +376,7 @@ trait CompileTimeAssertions {
376376
* @param isValid a function used to validate a literal value parsed from the given expression
377377
*/
378378
def ensureValidCharLiteral(value: Expr[Char], notValidMsg: String, notLiteralMsg: String)(isValid: Char => Boolean)(implicit qctx: QuoteContext): Unit = {
379-
import qctx.tasty._
379+
import qctx.tasty.{_, given}
380380

381381
value.unseal.underlyingArgument match {
382382
case Literal(charConst) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object NumericStringMacro {
2525
def isValid(s: String): Boolean = s.forall(c => c >= '0' && c <= '9')
2626

2727
def apply(value: Expr[String])(implicit qctx: QuoteContext): Expr[NumericString] = {
28-
import qctx.tasty._
28+
import qctx.tasty.{_, given}
2929

3030
val notValidMsg =
3131
"NumericString.apply can only be invoked on String literals that contain numeric characters, i.e., decimal digits '0' through '9', " +

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object PercentageIntMacro {
2424
def isValid(i: Int): Boolean = i >= 0 && i <= 100
2525

2626
def apply(value: Expr[Int])(implicit qctx: QuoteContext): Expr[PercentageInt] = {
27-
import qctx.tasty._
27+
import qctx.tasty.{_, given}
2828

2929
val notValidMsg =
3030
"PercentageInt.apply can only be invoked on Int literals between 0 and 100, "+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ object RegexStringMacro {
4343
}
4444

4545
def apply(value: Expr[String])(implicit qctx: QuoteContext): Expr[RegexString] = {
46-
import qctx.tasty._
46+
import qctx.tasty.{_, given}
4747

4848
val notValidExceptionMsg: String = {
4949
value.unseal match {

scalactic.dotty/src/main/scala/org/scalactic/source/Position.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object Position {
6767
* Helper method for Position macro.
6868
*/
6969
private def genPosition(implicit qctx: QuoteContext): Expr[Position] = {
70-
import qctx.tasty._
70+
import qctx.tasty.{_, given}
7171

7272
val file = rootPosition.sourceFile
7373
val fileName: String = file.jpath.getFileName.toString

0 commit comments

Comments
 (0)