nullable safe calls supported (for methods and instances)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class Library {
|
||||
static void call() {}
|
||||
|
||||
static String getString() { return ""; }
|
||||
}
|
||||
|
||||
class User {
|
||||
void main() {
|
||||
Library.call();
|
||||
Library.getString().isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace {
|
||||
open class Library {
|
||||
class object {
|
||||
fun call() : Unit {
|
||||
}
|
||||
fun getString() : String? {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
open class User {
|
||||
fun main() : Unit {
|
||||
Library.call()
|
||||
Library.getString()?.isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class Library {
|
||||
void call() {}
|
||||
|
||||
String getString() { return ""; }
|
||||
}
|
||||
|
||||
class User {
|
||||
void main() {
|
||||
Library lib = new Library();
|
||||
lib.call();
|
||||
lib.getString().isEmpty();
|
||||
|
||||
new Library().call();
|
||||
new Library().getString().isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace {
|
||||
open class Library {
|
||||
fun call() : Unit {
|
||||
}
|
||||
fun getString() : String? {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
open class User {
|
||||
fun main() : Unit {
|
||||
var lib : Library? = Library()
|
||||
lib?.call()
|
||||
lib?.getString()?.isEmpty()
|
||||
Library().call()
|
||||
Library().getString()?.isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Library {
|
||||
final public String myString;
|
||||
}
|
||||
|
||||
class User {
|
||||
void main() {
|
||||
Library.myString.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace {
|
||||
open class Library {
|
||||
public val myString : String?
|
||||
}
|
||||
open class User {
|
||||
fun main() : Unit {
|
||||
Library.myString?.isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user