Nullability-related warnings for receivers

#KT-6723 In Progress
This commit is contained in:
Andrey Breslav
2015-02-03 18:18:41 +03:00
parent 5db6bb04e3
commit fcac449c70
14 changed files with 143 additions and 23 deletions
@@ -24,15 +24,15 @@ fun test() {
var platformJ = J.staticJ
+platformNN
+platformN
+<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
+platformJ
++platformNN
++platformN
++<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
++platformJ
platformNN++
platformN++
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>++
platformJ++
1 + platformNN
@@ -40,7 +40,7 @@ fun test() {
1 + platformJ
platformNN + 1
platformN + 1
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> + 1
platformJ + 1
1 plus platformNN
@@ -48,11 +48,11 @@ fun test() {
1 plus platformJ
platformNN plus 1
platformN plus 1
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> plus 1
platformJ plus 1
platformNN += 1
platformN += 1
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> += 1
platformJ += 1
}
@@ -22,5 +22,5 @@ public class J {
import p.*
var A by J.staticNN
var B by J.staticN
var B by <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
var C by J.staticJ
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: p/J.java
package p;
@@ -24,13 +26,24 @@ fun test() {
val platformJ = J.staticJ
platformNN.foo()
platformN.foo()
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
platformJ.foo()
with(platformNN) {
foo()
}
with(platformN) {
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>foo<!>()
}
with(platformJ) {
foo()
}
platformNN.bar()
platformN.bar()
platformJ.bar()
}
fun J.foo() {}
fun J?.bar() {}
fun J?.bar() {}
fun <T> with(t: T, f: T.() -> Unit) {}
@@ -1,5 +1,6 @@
package
internal fun test(): kotlin.Unit
internal fun </*0*/ T> with(/*0*/ t: T, /*1*/ f: T.() -> kotlin.Unit): kotlin.Unit
internal fun p.J?.bar(): kotlin.Unit
internal fun p.J.foo(): kotlin.Unit
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: p/J.java
package p;
@@ -26,6 +28,19 @@ fun test() {
val platformJ = J.staticJ
platformNN.foo()
platformN.foo()
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>.foo()
platformJ.foo()
}
with(platformNN) {
foo()
}
with(platformN) {
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>foo<!>()
}
with(platformJ) {
foo()
}
}
fun <T> with(t: T, f: T.() -> Unit) {}
@@ -1,3 +1,4 @@
package
internal fun test(): kotlin.Unit
internal fun </*0*/ T> with(/*0*/ t: T, /*1*/ f: T.() -> kotlin.Unit): kotlin.Unit
@@ -25,7 +25,7 @@ fun test() {
val platformJ = J.staticJ
for (x in platformNN) {}
for (x in platformN) {}
for (x in <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>) {}
for (x in platformJ) {}
}
@@ -21,7 +21,7 @@ import p.*
fun test() {
J.staticNN()
J.staticN()
J.<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>staticN<!>()
J.staticJ()
}
@@ -30,7 +30,7 @@ fun test() {
val platformJ = J.staticJ
val (a1, b1) = platformNN
val (a2, b2) = platformN
val (a2, b2) = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
val (a3, b3) = platformJ
}