Skip to content

Commit 9d8061c

Browse files
committed
Merge branch 'cheeseng-feature-dotty-0.21-cherry-pick' into 3.1.x
2 parents b09f104 + 02f562b commit 9d8061c

File tree

56 files changed

+463
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+463
-646
lines changed

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

Lines changed: 2 additions & 2 deletions
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._
13-
rootPosition.startLine.toExpr
12+
import qctx.tasty.{_, given}
13+
Expr(rootPosition.startLine)
1414
}
1515
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import scala.collection.SortedSet
2626
import FailureMessages.decorateToStringValue
2727
import java.util.concurrent.Executors
2828
import org.scalactic.Prettifier
29+
import org.scalactic.ArrayHelper.deep
2930

3031
object SharedHelpers extends Assertions with LineNumberHelper {
3132

@@ -855,7 +856,7 @@ object SharedHelpers extends Assertions with LineNumberHelper {
855856
case map: GenMap[_, _] => element.asInstanceOf[Tuple2[_, _]]._1
856857
case genTrv: GenTraversable[_] => getIndex(xs, element)
857858
}
858-
Array(indexOrKey.toString, element.length.toString, (if (element != null && element.isInstanceOf[Array[_]]) element.asInstanceOf[Array[T]].deep.toString else element.toString))
859+
Array(indexOrKey.toString, element.length.toString, (if (element != null && element.isInstanceOf[Array[_]]) deep(element.asInstanceOf[Array[T]]).toString else element.toString))
859860
}
860861

861862
def indexLengthElement[T](itr: java.util.Iterator[String], xs: java.util.Collection[String], errorFun: String => Boolean): Array[String] = {
@@ -865,7 +866,7 @@ object SharedHelpers extends Assertions with LineNumberHelper {
865866
case map: java.util.Map[_, _] => element.asInstanceOf[java.util.Map.Entry[_, _]].getKey
866867
case genTrv: java.util.Collection[_] => getIndex(xs, element)
867868
}
868-
Array(indexOrKey.toString, element.length.toString, (if (element != null && element.isInstanceOf[Array[_]]) element.asInstanceOf[Array[T]].deep.toString else element.toString))
869+
Array(indexOrKey.toString, element.length.toString, (if (element != null && element.isInstanceOf[Array[_]]) deep(element.asInstanceOf[Array[T]]).toString else element.toString))
869870
}
870871

871872
def indexElementLengthString[T](itr: Iterator[String], xs: GenTraversable[String], errorFun: String => Boolean): Array[String] = {

project/DottyBuild.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ trait DottyBuild { this: BuildCommons =>
1313

1414
// List of available night build at https://repo1.maven.org/maven2/ch/epfl/lamp/dotty-compiler_0.14/
1515
// lazy val dottyVersion = dottyLatestNightlyBuild.get
16-
lazy val dottyVersion = "0.17.0-RC1"
16+
lazy val dottyVersion = "0.21.0-RC1"
1717
lazy val dottySettings = List(
1818
scalaVersion := dottyVersion,
1919
libraryDependencies := libraryDependencies.value.map(_.withDottyCompat(scalaVersion.value)),
20-
libraryDependencies --= scalaLibraries(scalaVersion.value),
21-
scalacOptions := List("-language:Scala2,implicitConversions")
20+
scalacOptions ++= List("-language:implicitConversions", "-noindent", "-Xprint-suspension")
2221
)
2322

2423
lazy val scalacticDotty = Project("scalacticDotty", file("scalactic.dotty"))

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",

project/GenArrayHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object GenArrayHelper {
2121

2222
def genMain(targetDir: File, version: String, scalaVersion: String): Seq[File] = {
2323
val content =
24-
if (scalaVersion startsWith "2.13")
24+
if (ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
2525
"""/*
2626
| * Copyright 2001-2018 Artima, Inc.
2727
| *

project/GenColCompatHelper.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object GenColCompatHelper {
2121

2222
def genMain(targetDir: File, version: String, scalaVersion: String): Seq[File] = {
2323
val content =
24-
if (scalaVersion startsWith "2.13")
24+
if (ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
2525
"""/*
2626
| * Copyright 2001-2018 Artima, Inc.
2727
| *
@@ -139,7 +139,7 @@ object GenColCompatHelper {
139139

140140
def genTest(targetDir: File, version: String, scalaVersion: String): Seq[File] = {
141141
val chainSpec =
142-
if (scalaVersion startsWith "2.13")
142+
if (ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
143143
"""/*
144144
| * Copyright 2001-2018 Artima, Inc.
145145
| *
@@ -213,7 +213,7 @@ object GenColCompatHelper {
213213
""".stripMargin
214214

215215
val everySpec =
216-
if (scalaVersion startsWith "2.13")
216+
if (ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
217217
"""/*
218218
| * Copyright 2001-2018 Artima, Inc.
219219
| *

project/GenCompatibleClasses.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ object GenCompatibleClasses {
8080
targetDir.mkdirs()
8181
val file = new File(targetDir, "CompatParColls.scala")
8282
if (!file.exists || generatorSource.lastModified > file.lastModified) {
83-
val parMethod = if (scalaVersion startsWith "2.13") "def par: T = oriCol" else ""
83+
val parMethod = if(ScalaVersionHelper.isStdLibCompat_213(scalaVersion)) "def par: T = oriCol" else ""
8484
/*
8585
For recording purpose, this is the original version of CompatParColls that stops working in 2.13.0-M4
8686
/**

project/GenConfigMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object GenConfigMap {
2121

2222
def genMain(targetDir: File, version: String, scalaVersion: String): Seq[File] = {
2323
val content =
24-
if (scalaVersion startsWith "2.13")
24+
if(ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
2525
"""/*
2626
| * Copyright 2001-2013 Artima, Inc.
2727
| *

project/GenEvery.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import scala.io.Source
66
object GenEvery {
77

88
def transformLine(line: String, scalaVersion: String): String = {
9-
if (scalaVersion startsWith "2.13")
9+
if(ScalaVersionHelper.isStdLibCompat_213(scalaVersion))
1010
line
1111
.replaceAllLiterally(": Map[K, Every[T]]", ": scala.collection.MapView[K, org.scalactic.Every[T]]")
1212
.replaceAllLiterally("final def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, T, Col[T @uV]]): Col[T @uV] = underlying.to[Col](cbf)",

project/GenScalaTestDotty.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ object GenScalaTestDotty {
164164
"org/scalatest/matchers/dsl" -> List(
165165
"BeWord.scala",
166166
"JavaCollectionWrapper.scala",
167-
"JavaMapWrapper.scala",
167+
"JavaMapWrapper.scala",
168168
"MatchPatternWord.scala",
169-
"NotWord.scala",
169+
"NotWord.scala",
170170
"ResultOfNotWordForAny.scala"
171171
),
172172
"org/scalatest/matchers/should" -> List.empty,
@@ -191,17 +191,17 @@ object GenScalaTestDotty {
191191
copyFiles("scalatest-test/src/test/scala/org/scalatest", "org/scalatest", targetDir,
192192
List(
193193
"AssertionsSpec.scala",
194-
"ShouldCompileSpec.scala",
195-
"ShouldNotCompileSpec.scala"/*,
196-
"ShouldNotTypeCheckSpec.scala"*/
194+
// "ShouldCompileSpec.scala",
195+
// "ShouldNotCompileSpec.scala",
196+
// "ShouldNotTypeCheckSpec.scala"
197197
)
198-
) ++
199-
copyDir("scalatest-test/src/test/scala/org/scalatest/diagrams", "org/scalatest/diagrams", targetDir, List.empty) ++
200-
copyDir("scalatest-test/src/test/scala/org/scalatest/expectations", "org/scalatest/expectations", targetDir,
198+
) ++
199+
copyDir("scalatest-test/src/test/scala/org/scalatest/diagrams", "org/scalatest/diagrams", targetDir, List.empty) ++
200+
copyDir("scalatest-test/src/test/scala/org/scalatest/expectations", "org/scalatest/expectations", targetDir,
201201
List(
202202
"DirectExpectationsSpec.scala"
203203
)
204-
)
204+
)
205205
/*++
206206
copyDir("scalatest-test/src/test/scala/org/scalatest/concurrent", "org/scalatest/concurrent", targetDir,
207207
List(

0 commit comments

Comments
 (0)