Skip to content

Commit 0d004ab

Browse files
authored
Merge pull request scala#10785 from scala-steward/update/scala3-compiler_3-3.4.2
Update scala3-compiler_3, ... to 3.4.2
2 parents 547a6f1 + bd246ee commit 0d004ab

File tree

6 files changed

+51
-19
lines changed

6 files changed

+51
-19
lines changed

project/DottySupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import sbt.librarymanagement.{
1212
* Settings to support validation of TastyUnpickler against the release of dotty with the matching TASTy version
1313
*/
1414
object TastySupport {
15-
val supportedTASTyRelease = "3.4.1" // TASTY: 28.4-0
15+
val supportedTASTyRelease = "3.4.2" // TASTY: 28.4-0
1616
val scala3Compiler = "org.scala-lang" % "scala3-compiler_3" % supportedTASTyRelease
1717
val scala3Library = "org.scala-lang" % "scala3-library_3" % supportedTASTyRelease
1818

src/tastytest/scala/tools/tastytest/Diff.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ import scala.jdk.CollectionConverters._
1616
import com.github.difflib.{DiffUtils, UnifiedDiffUtils}
1717

1818
object Diff {
19+
def removeTrailing(str: String): String = {
20+
val lastWhitespace = str.reverseIterator.indexWhere(!_.isWhitespace)
21+
if (lastWhitespace == -1) str
22+
else str.dropRight(lastWhitespace)
23+
}
24+
25+
1926
def splitIntoLines(string: String): Seq[String] =
20-
string.trim.linesIterator.toSeq
27+
string.linesIterator.map(removeTrailing).toSeq
28+
29+
def splitIntoLines(stream: java.util.stream.Stream[String]): Seq[String] =
30+
stream.map(removeTrailing).iterator().asScala.toSeq
2131

2232
def compareContents(output: String, check: String): String =
2333
compareContents(splitIntoLines(output), splitIntoLines(check))

src/tastytest/scala/tools/tastytest/Files.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ object Files {
7878
}
7979

8080
def processLines[A](file: String)(op: ju.stream.Stream[String] => A): A = {
81-
var stream: java.util.stream.Stream[String] = null
82-
try {
83-
stream = JFiles.lines(JPaths.get(file))
81+
val stream: java.util.stream.Stream[String] = JFiles.lines(JPaths.get(file))
82+
try
8483
op(stream)
85-
}
86-
finally if (stream != null) {
84+
finally
8785
stream.close()
88-
}
86+
8987
}
9088

9189
def use[T](resource: String)(op: jl.Iterable[String] => Try[T]): Try[T] = Try {

src/tastytest/scala/tools/tastytest/TastyTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ object TastyTest {
311311
printerrln(s"ERROR: $source did not compile when expected to. Perhaps it should match (**/*${ScalaFail.name})")
312312
case Some((Some(checkFile), _)) if Check.permits(checkFile) =>
313313
processLines(checkFile) { stream =>
314-
val checkLines = stream.iterator().asScala.toSeq
314+
val checkLines = Diff.splitIntoLines(stream)
315315
val outputLines = Diff.splitIntoLines(output)
316316
val diff = Diff.compareContents(outputLines, checkLines)
317317
if (diff.nonEmpty) {
Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
11
-- Error: TestExperimentalDefsPre_fail.scala:1:18
22
1 |import downstream.ExperimentalDefsPre.*
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
|object ExperimentalDefsPre is marked @experimental and therefore may only be used in an experimental scope.
4+
| Experimental definition may only be used under experimental mode:
5+
| 1. in a definition marked as @experimental, or
6+
| 2. compiling with the -experimental compiler flag, or
7+
| 3. with a nightly or snapshot version of the compiler.
8+
|
9+
| object ExperimentalDefsPre is marked @experimental
10+
|
511
-- Error: TestExperimentalDefsPre_fail.scala:4:10
612
4 | def test = new SubExperimentalNotExperimental
713
| ^
8-
|object ExperimentalDefsPre is marked @experimental and therefore may only be used in an experimental scope.
14+
| Experimental definition may only be used under experimental mode:
15+
| 1. in a definition marked as @experimental, or
16+
| 2. compiling with the -experimental compiler flag, or
17+
| 3. with a nightly or snapshot version of the compiler.
18+
|
19+
| object ExperimentalDefsPre is marked @experimental
20+
|
921
-- Error: TestExperimentalDefsPre_fail.scala:4:17
1022
4 | def test = new SubExperimentalNotExperimental
1123
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
|object ExperimentalDefsPre is marked @experimental and therefore may only be used in an experimental scope.
24+
| Experimental definition may only be used under experimental mode:
25+
| 1. in a definition marked as @experimental, or
26+
| 2. compiling with the -experimental compiler flag, or
27+
| 3. with a nightly or snapshot version of the compiler.
28+
|
29+
| object ExperimentalDefsPre is marked @experimental
30+
|
1331
-- Error: TestExperimentalDefsPre_fail.scala:6:35
1432
6 | class SubSubExperimental extends SubExperimentalNotExperimental
1533
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16-
|object ExperimentalDefsPre is marked @experimental and therefore may only be used in an experimental scope.
34+
| Experimental definition may only be used under experimental mode:
35+
| 1. in a definition marked as @experimental, or
36+
| 2. compiling with the -experimental compiler flag, or
37+
| 3. with a nightly or snapshot version of the compiler.
38+
|
39+
| object ExperimentalDefsPre is marked @experimental
40+
|
1741
4 errors found
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
TestRawTypes_fail.scala:15: error: type mismatch;
22
found : lib.RawTypes#C[String]#D[String]
33
required: lib.RawTypes#C[T]#D[_]
4-
Note: String <: Object, but Java-defined class D is invariant in type U.
5-
You may wish to investigate a wildcard type such as `_ <: Object`. (SLS 3.2.10)
4+
Note: String <: Any, but Java-defined class D is invariant in type U.
5+
You may wish to investigate a wildcard type such as `_ <: Any`. (SLS 3.2.10)
66
RawTypes.mii_Raw_Raw(cd_ii) // error
77
^
88
TestRawTypes_fail.scala:16: error: type mismatch;
99
found : lib.RawTypes#C[String]#D[String]#E[String]
1010
required: lib.RawTypes#C[T]#D[U]#E[_]
11-
Note: String <: Object, but Java-defined class E is invariant in type V.
12-
You may wish to investigate a wildcard type such as `_ <: Object`. (SLS 3.2.10)
11+
Note: String <: Any, but Java-defined class E is invariant in type V.
12+
You may wish to investigate a wildcard type such as `_ <: Any`. (SLS 3.2.10)
1313
RawTypes.miii_Raw_Raw_Raw(cde_iii) // error
1414
^
1515
TestRawTypes_fail.scala:18: error: type mismatch;
1616
found : lib.RawTypes.CStatic[String]#D[String]
1717
required: lib.RawTypes.CStatic[T]#D[_]
18-
Note: String <: Object, but Java-defined class D is invariant in type U.
19-
You may wish to investigate a wildcard type such as `_ <: Object`. (SLS 3.2.10)
18+
Note: String <: Any, but Java-defined class D is invariant in type U.
19+
You may wish to investigate a wildcard type such as `_ <: Any`. (SLS 3.2.10)
2020
RawTypes.msi_Raw_Raw(cd_si) // error
2121
^
2222
3 errors

0 commit comments

Comments
 (0)