nullable safe calls supported (only for fields)

This commit is contained in:
Sergey Ignatov
2011-11-07 15:22:36 +04:00
parent b4d5ff5ff8
commit 8f1727882a
13 changed files with 89 additions and 5 deletions
@@ -0,0 +1,9 @@
class Library {
final static java.io.PrintStream ourOut;
}
class User {
void main() {
Library.ourOut.print();
}
}
@@ -0,0 +1,12 @@
namespace {
open class Library {
class object {
val ourOut : PrintStream?
}
}
open class User {
fun main() : Unit {
Library.ourOut?.print()
}
}
}
@@ -0,0 +1 @@
System.out.println("Hello, world");
+1
View File
@@ -0,0 +1 @@
System.`out`?.println("Hello, world")
@@ -5,6 +5,6 @@ RED
YELLOW
BLUE
override public fun run() : Unit {
System.out.println(("name()=" + name() + ", toString()=" + toString()))
System.`out`?.println(("name()=" + name() + ", toString()=" + toString()))
}
}
@@ -21,7 +21,7 @@ break@test
}
}
}
System.out.println((if (foundIt)
System.`out`?.println((if (foundIt)
"Found it"
else
"Didn't find it"))
@@ -1 +1 @@
(o.toString() + "abc")
(str.toString() + "abc")
@@ -1 +1 @@
((o.toString() + "abc"))
((str.toString() + "abc"))