Nullablility diagnostics for extension functions

This commit is contained in:
Andrey Breslav
2011-05-30 20:09:04 +04:00
parent 02565f669c
commit 6319ada926
17 changed files with 166 additions and 77 deletions
+34 -2
View File
@@ -6,7 +6,7 @@ fun <T, E> T.foo(x : E, y : A) : T {
y plus 1
y + 1.0
this?.minus<T>(this)
this<warning>?.</warning>minus<T>(this)
this
}
@@ -35,4 +35,36 @@ val Int.abs : Int
val <T> T.foo : T
fun Int.foo() = this
fun Int.foo() = this
namespace null_safety {
fun parse(cmd: String): Command? { return null }
class Command() {
// fun equals(other : Any?) : Boolean
val foo : Int
}
fun Any.equals(other : Any?) : Boolean
fun Any?.equals1(other : Any?) : Boolean
fun main(args: Array<String>) {
System.out?.print(1)
val command = parse("")
command<error>.</error>foo
command<error>.</error>equals(null)
command?.equals(null)
command.equals1(null)
command<warning>?.</warning>equals1(null)
val c = new Command()
c<warning>?.</warning>equals(null)
if (command == null) 1
}
}