Skip to content

Commit 3141a4c

Browse files
committed
Update tests
1 parent 08b3175 commit 3141a4c

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/util/ClasspathFromClassloader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object ClasspathFromClassloader {
1414
* BEWARE: with exotic enough classloaders, this may not work at all or do
1515
* the wrong thing.
1616
*/
17-
def apply(cl: ClassLoader): String = {
17+
def apply(cl: ClassLoader | Null): String = {
1818
val classpathBuff = List.newBuilder[String]
1919
def collectClassLoaderPaths(cl: ClassLoader): Unit = {
2020
if (cl != null) {

tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object EvenFromDigitsImpl:
1010
try evenFromDigits(ds)
1111
catch {
1212
case ex: FromDigits.FromDigitsException =>
13-
quotes.reflect.report.error(ex.getMessage)
13+
quotes.reflect.report.error(ex.getMessage.nn)
1414
Even(0)
1515
}
1616
'{Even(${Expr(ev.n)})}

tests/pos-with-compiler/Fileish.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Fileish(val path: Path, val input: () => InputStream) extends Streamable.C
1919

2020
private lazy val pkgLines = lines() collect { case x if x startsWith "package " => x stripPrefix "package" trim }
2121
lazy val pkgFromPath = parent.path.replaceAll("""[/\\]""", ".")
22-
lazy val pkgFromSource = pkgLines map (_ stripSuffix ";") mkString "."
22+
lazy val pkgFromSource = pkgLines map (_.nn.stripSuffix(";")) mkString "."
2323

2424
override def toString = path.path
2525
}
@@ -32,7 +32,7 @@ class Fileish2(val path: Path, val input: () => InputStream) extends Streamable.
3232

3333
private val pkgLines = lines() collect { case x if x startsWith "package " => x stripPrefix "package" trim }
3434
lazy val pkgFromPath = parent.path.replaceAll("""[/\\]""", ".")
35-
lazy val pkgFromSource = pkgLines map (_ stripSuffix ";") mkString "."
35+
lazy val pkgFromSource = pkgLines map (_.nn.stripSuffix(";")) mkString "."
3636

3737
override def toString = path.path
3838
}
@@ -46,7 +46,7 @@ class Fileish3(val path: Path, val input: () => InputStream) extends Streamable.
4646

4747
private val pkgLines = lines() collect { case x if x startsWith "package " => x stripPrefix "package" trim }
4848
private val pkgFromPath = parent.path.replaceAll("""[/\\]""", ".")
49-
private val pkgFromSource = pkgLines map (_ stripSuffix ";") mkString "."
49+
private val pkgFromSource = pkgLines map (_.nn.stripSuffix(";")) mkString "."
5050

5151
override def toString = path.path
5252
}

tests/pos-with-compiler/Patterns.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import dotty.tools.dotc.ast.Trees.*
22
import dotty.tools.dotc.core.Types.*
33

44
object Patterns {
5-
val d: Object = null
5+
val d: Object = null.asInstanceOf[Object]
66
private def rebase(tp: NamedType): Type = {
77
def rebaseFrom(prefix: Type): Type = ???
88
tp.prefix match {

tests/pos-with-compiler/benchSets.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def testAnyRefMap =
7878
i += 1
7979
while i > 0 do
8080
i -= 1
81-
val v = set.getOrNull(elems(i))
81+
val v: Elem | Null = set.getOrNull(elems(i))
8282
if v != null then
8383
count += 1
8484
iter += 1

tests/pos-with-compiler/lazyValsSepComp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import dotty.tools.dotc.core.Contexts.*
1010

1111
/** A test to trigger issue with separate compilation and lazy vals */
1212
object Foo {
13-
val definitions: Definitions = null
13+
val definitions: Definitions = null.asInstanceOf[Definitions]
1414
def defn = definitions
1515
def go = defn.ScalaBoxedClasses
1616
}

tests/run-with-compiler/i14541.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Test:
44
import dotty.tools.runner.RichClassLoader.*
55
val classpath = dotty.tools.dotc.util.ClasspathFromClassloader(getClass.getClassLoader)
66
def main(args: Array[String]): Unit =
7-
getClass.getClassLoader.run("echo", List("hello", "raw", "world"))
7+
getClass.getClassLoader.nn.run("echo", List("hello", "raw", "world"))
88
// caution: uses "SCALA_OPTS"
99
dotty.tools.MainGenericRunner.main(Array("--class-path", classpath, "echo", "hello", "run", "world"))
1010

tests/run-with-compiler/scripting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Test {
22
def main(args: Array[String]): Unit = {
33
val m = new javax.script.ScriptEngineManager(getClass().getClassLoader())
4-
val e = m.getEngineByName("scala")
4+
val e = m.getEngineByName("scala").nn
55
println(e.eval("42"))
66
println(e.eval("Some(42)").asInstanceOf[Option[Int]].get)
77
println(e.eval(new java.io.StringReader("42")))

0 commit comments

Comments
 (0)