Skip to content

Commit 9694218

Browse files
authored
Merge pull request #615 from scala/backport-lts-3.3-24086
Backport "Regression test scala#16004" to 3.3 LTS
2 parents 71b44f0 + f46c2c2 commit 9694218

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

compiler/test/dotty/tools/dotc/reporting/TestReporter.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
3636
final def messages: Iterator[String] = _messageBuf.iterator
3737

3838
protected final val _consoleBuf = new StringWriter
39-
protected final val _consoleReporter = new ConsoleReporter(null, new PrintWriter(_consoleBuf)):
39+
protected final val _consoleReporter = new ConsoleReporter(scala.Console.in, new PrintWriter(_consoleBuf)):
4040
override protected def renderPath(file: AbstractFile): String = TestReporter.renderPath(file)
4141

4242
final def consoleOutput: String = _consoleBuf.toString
@@ -123,7 +123,7 @@ object TestReporter {
123123

124124
def logPath: String = {
125125
initLog()
126-
outFile.getCanonicalPath
126+
outFile.getCanonicalPath.nn
127127
}
128128

129129
def reporter(ps: PrintStream, logLevel: Int): TestReporter =
@@ -160,7 +160,7 @@ object TestReporter {
160160
Properties.rerunFailed &&
161161
failedTestsFile.exists() &&
162162
failedTestsFile.isFile
163-
)(readAllLines(failedTestsFile.toPath).asScala.toList)
163+
)(readAllLines(failedTestsFile.toPath).nn.asScala.toList)
164164

165165
def writeFailedTests(tests: List[String]): Unit =
166166
initLog()
@@ -169,7 +169,7 @@ object TestReporter {
169169

170170
def renderPath(file: AbstractFile): String =
171171
if JFile.separatorChar == '\\' then
172-
file.path.replace('\\', '/')
172+
file.path.replace('\\', '/').nn
173173
else
174174
file.path
175175
}

compiler/test/dotty/tools/vulpix/VulpixUnitTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ class VulpixUnitTests:
7979
compileFile("tests/vulpix-tests/unit/deadlock.scala", defaultOptions).expectFailure.checkRuns()
8080

8181
@test def badJava: Unit =
82-
assertThrows[AssertionError](_.getMessage.contains("java compilation failed")):
82+
assertThrows[AssertionError](_.getMessage.nn.contains("java compilation failed")):
8383
compileFile("tests/vulpix-tests/unit/BadJava.java", defaultOptions)
8484
.suppressAllOutput
8585
.checkCompile()
8686

8787
@test def runTimeout: Unit =
8888
val fileName = s"tests/vulpix-tests/unit/timeout.scala"
8989
val expect = """(?m).*test '.+' timed out.*"""
90-
assertThrows[AssertionError](_.getMessage.linesIterator.toList.last.matches(expect)):
90+
assertThrows[AssertionError](_.getMessage.nn.linesIterator.toList.last.matches(expect)):
9191
compileFile(fileName, defaultOptions)
9292
.suppressAllOutput
9393
.checkRuns()

tests/pos/i16004.scala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
import scala.concurrent.duration.FiniteDuration
3+
import scala.concurrent.duration._
4+
5+
trait Resource[F[_], A]
6+
trait IO[A]
7+
8+
trait Cache[F[_], K, V]
9+
10+
object Cache {
11+
12+
final case class Config(expireAfterRead: FiniteDuration)
13+
14+
def expiring[F[_], K, V](
15+
expireAfter: FiniteDuration
16+
): Resource[F, Cache[F, K, V]] = ???
17+
18+
def expiring[F[_], K, V](
19+
config: Config,
20+
partitions: Option[Int] = None
21+
): Resource[F, Cache[F, K, V]] = ???
22+
23+
/* Without partitions being specified, error is yielded */
24+
25+
val notCompiling = expiring[IO, Int, Int](
26+
config = Config(expireAfterRead = 1.minute)
27+
)
28+
29+
val compiling = expiring[IO, Int, Int](
30+
config = Config(expireAfterRead = 1.minute),
31+
partitions = None
32+
)
33+
}

0 commit comments

Comments
 (0)