Skip to content

Commit c46c9bf

Browse files
committed
Update compiler tests
1 parent 23b4a2d commit c46c9bf

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

compiler/test/dotty/tools/dotc/TupleShowTests.scala

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,28 @@ class TupleShowTests extends DottyTest:
5454

5555
@Test def tup3_show10 = chkEq("(Int,\n Long,\n Short)".normEOL, tup3.toText(ctx.printer).mkString(10, false))
5656

57-
val res21 = """|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
58-
| Int, Long, Long, Long, Long, Long, Int)""".stripMargin.normEOL
57+
val res21: String =
58+
"""|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
59+
| Int, Long, Long, Long, Long, Long, Int)""".stripMargin.normEOL
5960

60-
val res22 = """|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
61-
| Int, Long, Long, Long, Long, Long, Int, Long)""".stripMargin.normEOL
61+
val res22: String =
62+
"""|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
63+
| Int, Long, Long, Long, Long, Long, Int, Long)""".stripMargin.normEOL
6264

63-
val res23 = """|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
64-
| Int, Long, Long, Long, Long, Long, Int, Long, Short)""".stripMargin.normEOL
65+
val res23: String =
66+
"""|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
67+
| Int, Long, Long, Long, Long, Long, Int, Long, Short)""".stripMargin.normEOL
6568

66-
val res24 = """|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
67-
| Int, Long, Long, Long, Long, Long, Int, Long, Short, Short)""".stripMargin.normEOL
69+
val res24: String =
70+
"""|(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
71+
| Int, Long, Long, Long, Long, Long, Int, Long, Short, Short)""".stripMargin.normEOL
6872

6973
def chkEq[A](expected: A, obtained: A) = assert(expected == obtained, diff(s"$expected", s"$obtained"))
7074

7175
/** On Windows the string literal in this test source file will be read with `\n` (b/c of "-encoding UTF8")
7276
* but the compiler will correctly emit \r\n as the line separator.
7377
* So we align the expected result to faithfully compare test results. */
74-
extension (str: String) def normEOL = if EOL == "\n" then str else str.replace("\n", EOL)
78+
extension (str: String) def normEOL: String = if EOL == "\n" then str else str.replace("\n", EOL)
7579

7680
def diff(exp: String, obt: String) =
7781
val min = math.min(exp.length, obt.length)

compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import dotty.tools.dotc.util.SourceFile
3333
* only 1 semanticdb file should be present
3434
* @param source the single source file producing the semanticdb
3535
*/
36-
@main def metac(root: String, source: String) =
36+
@main def metac(root: String, source: String): Unit =
3737
val rootSrc = Paths.get(root)
3838
val sourceSrc = Paths.get(source)
3939
val semanticFile = FileSystems.getDefault.getPathMatcher("glob:**.semanticdb")
@@ -53,13 +53,13 @@ import dotty.tools.dotc.util.SourceFile
5353

5454
@Category(Array(classOf[BootstrappedOnlyTests]))
5555
class SemanticdbTests:
56-
val javaFile = FileSystems.getDefault.getPathMatcher("glob:**.java")
57-
val scalaFile = FileSystems.getDefault.getPathMatcher("glob:**.scala")
58-
val expectFile = FileSystems.getDefault.getPathMatcher("glob:**.expect.scala")
59-
val rootSrc = Paths.get(System.getProperty("dotty.tools.dotc.semanticdb.test"))
60-
val expectSrc = rootSrc.resolve("expect")
61-
val javaRoot = rootSrc.resolve("javacp")
62-
val metacExpectFile = rootSrc.resolve("metac.expect")
56+
val javaFile: PathMatcher = FileSystems.getDefault.getPathMatcher("glob:**.java")
57+
val scalaFile: PathMatcher = FileSystems.getDefault.getPathMatcher("glob:**.scala")
58+
val expectFile: PathMatcher = FileSystems.getDefault.getPathMatcher("glob:**.expect.scala")
59+
val rootSrc: Path = Paths.get(System.getProperty("dotty.tools.dotc.semanticdb.test"))
60+
val expectSrc: Path = rootSrc.resolve("expect")
61+
val javaRoot: Path = rootSrc.resolve("javacp")
62+
val metacExpectFile: Path = rootSrc.resolve("metac.expect")
6363

6464
@Category(Array(classOf[dotty.SlowTests]))
6565
@Test def expectTests: Unit = if (!scala.util.Properties.isWin) runExpectTest(updateExpectFiles = false)

compiler/test/dotty/tools/repl/AbstractFileClassLoaderTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AbstractFileClassLoaderTest:
2929
// cf ScalaClassLoader#classBytes
3030
extension (loader: ClassLoader)
3131
// An InputStream representing the given class name, or null if not found.
32-
def classAsStream(className: String) = loader.getResourceAsStream {
32+
def classAsStream(className: String): InputStream = loader.getResourceAsStream {
3333
if className.endsWith(".class") then className
3434
else s"${className.replace('.', '/')}.class" // classNameToPath
3535
}

compiler/test/dotty/tools/scripting/ScriptTestEnv.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ object ScriptTestEnv {
282282
}
283283

284284
extension(f: File) {
285-
def name = f.getName
285+
def name: String = f.getName
286286
def norm: String = f.toPath.normalize.norm
287287
def absPath: String = f.getAbsolutePath.norm
288288
def relpath: Path = f.toPath.relpath
@@ -305,7 +305,7 @@ object ScriptTestEnv {
305305
// dist[*]/target/universal/stage, if present
306306
// else, SCALA_HOME if defined
307307
// else, not defined
308-
lazy val envScalaHome =
308+
lazy val envScalaHome: String =
309309
printf("scalacPath: %s\n", scalacPath.norm)
310310
if scalacPath.isFile then scalacPath.replaceAll("/bin/scalac", "")
311311
else envOrElse("SCALA_HOME", "not-found").norm

compiler/test/dotty/tools/utils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def scriptsDir(path: String): File = {
3333
dir
3434
}
3535

36-
extension (f: File) def absPath =
36+
extension (f: File) def absPath: String =
3737
f.getAbsolutePath.replace('\\', '/')
3838

3939
extension (str: String) def dropExtension =

0 commit comments

Comments
 (0)