Skip to content

Commit 632ddd4

Browse files
evangirardinolhotak
authored andcommitted
Fix incorrectly-named run test for flexible types
1 parent 47802a6 commit 632ddd4

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

tests/flexible-types/run/array/S.scala

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
class Foo {
3+
def err(msg: String): Nothing = {
4+
throw new RuntimeException("Hello")
5+
}
6+
def retTypeNothing(): String = {
7+
val y: String|Null = ???
8+
if (y == null) err("y is null!")
9+
y
10+
}
11+
}
12+
*/
13+
14+
15+
object Test {
16+
def main() = {
17+
val i : Integer = new Integer(3) // Constructor with non-ref arg
18+
val s1 : String | Null = new String("abc") // Constructor with ref arg
19+
val s2 : String = new String("abc") // Constructor with ref arg, not null
20+
val s3 = s1.nn.substring(0,1).substring(0,1)
21+
val s4 = s2.substring(0,1).substring(0,1)
22+
val s5 = s4.startsWith(s4)
23+
// s1.substring(0,1) // error
24+
val j : J = new J("")
25+
println(s4)
26+
//val f : Foo = new Foo("x")
27+
//f.err("Hello")
28+
//val l : List[String] = Java.returnsNull();
29+
//val j : J = new J
30+
}
31+
}

0 commit comments

Comments
 (0)