[FE 1.0] Fix some foreign annotation tests
This commit is contained in:
committed by
Mikhael Bogdanov
parent
ca0b8be53b
commit
f84adcb378
+3
-5
@@ -20,8 +20,7 @@ fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeP
|
||||
a1.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a1.foo(1)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
a2.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.foo(null)
|
||||
a2.foo(1)
|
||||
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
@@ -30,9 +29,8 @@ fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeP
|
||||
a1.bar(x, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a1.bar(x, 1)
|
||||
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
a2.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar(x, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>, null)
|
||||
a2.bar(x, null)
|
||||
a2.bar(x, 1)
|
||||
}
|
||||
|
||||
+3
-5
@@ -20,8 +20,7 @@ fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeP
|
||||
a1.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a1.foo(1)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
a2.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.foo(null)
|
||||
a2.foo(1)
|
||||
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
@@ -30,9 +29,8 @@ fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeP
|
||||
a1.bar(x, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a1.bar(x, 1)
|
||||
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
a2.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar(x, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.bar(<!NULL_FOR_NONNULL_TYPE!>null<!>, null)
|
||||
a2.bar(x, null)
|
||||
a2.bar(x, 1)
|
||||
}
|
||||
compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt
Vendored
+2
-4
@@ -42,8 +42,7 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ak.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
akn.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
akn.foo(null)
|
||||
|
||||
bk.foo(bk)
|
||||
// jspecify_nullness_mismatch
|
||||
@@ -53,6 +52,5 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ck.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
ckn.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
ckn.foo(null)
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public open class AK : SelfType<AK> {
|
||||
public open class AKN : SelfType<@org.jspecify.nullness.Nullable AK?> {
|
||||
public constructor AKN()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
Vendored
+2
-4
@@ -42,8 +42,7 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ak.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
akn.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
akn.foo(null)
|
||||
|
||||
bk.foo(bk)
|
||||
// jspecify_nullness_mismatch
|
||||
@@ -53,6 +52,5 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ck.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
ckn.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
ckn.foo(null)
|
||||
}
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ public open class AK : SelfType<AK> {
|
||||
public open class AKN : SelfType<@org.jspecify.nullness.Nullable AK?> {
|
||||
public constructor AKN()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ t: @org.jspecify.nullness.Nullable AK?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+1
-2
@@ -33,8 +33,7 @@ fun <T : Test> main(a1: A<<!UPPER_BOUND_VIOLATED!>Any?<!>>, a2: A<Test>, b1: B<<
|
||||
a2.bar<<!UPPER_BOUND_VIOLATED!>T?<!>>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b1.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
b1.foo(null)
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
b1.bar<<!UPPER_BOUND_VIOLATED!>T?<!>>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
b1.bar<T>(x)
|
||||
|
||||
+1
-2
@@ -33,8 +33,7 @@ fun <T : Test> main(a1: A<<!UPPER_BOUND_VIOLATED!>Any?<!>>, a2: A<Test>, b1: B<<
|
||||
a2.bar<<!UPPER_BOUND_VIOLATED!>T?<!>>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
a2.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b1.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
b1.foo(null)
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
b1.bar<<!UPPER_BOUND_VIOLATED!>T?<!>>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
b1.bar<T>(x)
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package
|
||||
|
||||
public fun main(/*0*/ aNotNullNotNullNotNull: A<kotlin.Any, kotlin.Any, kotlin.Any>, /*1*/ aNotNullNotNullNull: A<kotlin.Any, kotlin.Any, kotlin.Any?>, /*2*/ aNotNullNullNotNull: A<kotlin.Any, kotlin.Any?, kotlin.Any>, /*3*/ aNotNullNullNull: A<kotlin.Any, kotlin.Any?, kotlin.Any?>, /*4*/ b: WildcardsWithDefault): kotlin.Unit
|
||||
|
||||
public open class A</*0*/ T : kotlin.Any!, /*1*/ E : @org.jspecify.nullness.Nullable kotlin.Any!, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!> {
|
||||
public constructor A</*0*/ T : kotlin.Any!, /*1*/ E : @org.jspecify.nullness.Nullable kotlin.Any!, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!>()
|
||||
public open class A</*0*/ T : kotlin.Any!, /*1*/ E, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!> {
|
||||
public constructor A</*0*/ T : kotlin.Any!, /*1*/ E, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package
|
||||
|
||||
public fun main(/*0*/ aNotNullNotNullNotNull: A<kotlin.Any, kotlin.Any, kotlin.Any>, /*1*/ aNotNullNotNullNull: A<kotlin.Any, kotlin.Any, kotlin.Any?>, /*2*/ aNotNullNullNotNull: A<kotlin.Any, kotlin.Any?, kotlin.Any>, /*3*/ aNotNullNullNull: A<kotlin.Any, kotlin.Any?, kotlin.Any?>, /*4*/ b: WildcardsWithDefault): kotlin.Unit
|
||||
|
||||
public open class A</*0*/ T : kotlin.Any!, /*1*/ E : @org.jspecify.nullness.Nullable kotlin.Any!, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!> {
|
||||
public constructor A</*0*/ T : kotlin.Any!, /*1*/ E : @org.jspecify.nullness.Nullable kotlin.Any!, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!>()
|
||||
public open class A</*0*/ T : kotlin.Any!, /*1*/ E, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!> {
|
||||
public constructor A</*0*/ T : kotlin.Any!, /*1*/ E, /*2*/ F : @org.jspecify.nullness.NullnessUnspecified kotlin.Any!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@ public class NullnessUnspecifiedTypeParameter<T> {
|
||||
public class Test {}
|
||||
|
||||
// FILE: main.kt
|
||||
// jspecify_nullness_mismatch
|
||||
fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeParameter<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, x: Test): Unit {
|
||||
fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
a1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a1.foo(1)
|
||||
|
||||
+1
-2
@@ -13,8 +13,7 @@ public class NullnessUnspecifiedTypeParameter<T> {
|
||||
public class Test {}
|
||||
|
||||
// FILE: main.kt
|
||||
// jspecify_nullness_mismatch
|
||||
fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeParameter<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, x: Test): Unit {
|
||||
fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeParameter<Any?>, x: Test): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
a1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a1.foo(1)
|
||||
|
||||
Vendored
+4
-2
@@ -43,7 +43,8 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ak.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
|
||||
akn.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
akn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
|
||||
bk.foo(bk)
|
||||
// jspecify_nullness_mismatch
|
||||
@@ -53,5 +54,6 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ck.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
|
||||
ckn.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
ckn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
Vendored
+4
-2
@@ -43,7 +43,8 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ak.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
|
||||
akn.foo(null) // the corresponding warning/error is present on the Java side
|
||||
// jspecify_nullness_mismatch
|
||||
akn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>) // the corresponding warning/error is present on the Java side
|
||||
|
||||
bk.foo(bk)
|
||||
// jspecify_nullness_mismatch
|
||||
@@ -53,5 +54,6 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
|
||||
// jspecify_nullness_mismatch
|
||||
ck.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
|
||||
ckn.foo(null) // the corresponding warning/error is present on the Java side
|
||||
// jspecify_nullness_mismatch
|
||||
ckn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>) // the corresponding warning/error is present on the Java side
|
||||
}
|
||||
+5
-6
@@ -20,27 +20,26 @@ public class B<T> {
|
||||
public class Test {}
|
||||
|
||||
// FILE: main.kt
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
fun <T : Test> main(a1: A<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, a2: A<Test>, b1: B<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, b2: B<Test>, x: T): Unit {
|
||||
fun <T : Test> main(a1: A<Any?>, a2: A<Test>, b1: B<Any?>, b2: B<Test>, x: T): Unit {
|
||||
a1.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
a1.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
a1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a1.bar<T>(x)
|
||||
|
||||
a2.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
a2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a2.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
b1.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
b1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
b1.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
b2.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
b2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
b2.bar<T>(x)
|
||||
}
|
||||
|
||||
+5
-6
@@ -20,27 +20,26 @@ public class B<T> {
|
||||
public class Test {}
|
||||
|
||||
// FILE: main.kt
|
||||
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
||||
fun <T : Test> main(a1: A<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, a2: A<Test>, b1: B<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, b2: B<Test>, x: T): Unit {
|
||||
fun <T : Test> main(a1: A<Any?>, a2: A<Test>, b1: B<Any?>, b2: B<Test>, x: T): Unit {
|
||||
a1.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
a1.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
a1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a1.bar<T>(x)
|
||||
|
||||
a2.foo(null)
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
a2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
a2.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
b1.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
b1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
b1.bar<T>(x)
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
b2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
// jspecify_nullness_mismatch
|
||||
b2.bar<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>T?<!>>(null)
|
||||
b2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
b2.bar<T>(x)
|
||||
}
|
||||
Reference in New Issue
Block a user