From 623b28961652ba0f75b8335bc17b9c54f07716ac Mon Sep 17 00:00:00 2001 From: pyos Date: Thu, 29 Jul 2021 15:38:53 +0200 Subject: [PATCH] Regenerate foreign annotation test data for FIR --- .../jspecify/strictMode/Defaults.fir.kt | 46 ------------------- .../jspecify/strictMode/Defaults.kt | 1 + .../strictMode/IgnoreAnnotations.fir.kt | 44 ------------------ .../jspecify/strictMode/IgnoreAnnotations.kt | 1 + .../NullnessUnspecifiedTypeParameter.fir.kt | 6 +++ .../jspecify/strictMode/SelfType.fir.kt | 3 ++ .../jspecify/strictMode/Simple.fir.kt | 3 ++ .../java8Tests/jspecify/strictMode/Simple.kt | 1 + .../TypeArgumentsFromParameterBounds.fir.kt | 2 + .../strictMode/TypeParameterBounds.fir.kt | 2 + 10 files changed, 19 insertions(+), 90 deletions(-) delete mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt delete mode 100644 compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt deleted file mode 100644 index 86e07ef317a..00000000000 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.fir.kt +++ /dev/null @@ -1,46 +0,0 @@ -// JSPECIFY_STATE: strict -// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode - -// FILE: Defaults.java -import org.jspecify.nullness.*; - -@NullMarked -public class Defaults { - public Foo defaultField = null; - @Nullable public Foo field = null; - - public Foo everythingNotNullable(Foo x) { return null; } - - public @Nullable Foo everythingNullable(@Nullable Foo x) { return null; } - - public @NullnessUnspecified Foo everythingUnknown(@NullnessUnspecified Foo x) { return null; } - - public @Nullable Foo mixed(Foo x) { return null; } - - public Foo explicitlyNullnessUnspecified(@NullnessUnspecified Foo x) { return null; } -} - -// FILE: Foo.java -public class Foo { - public Object foo() { return null; } -} - -// FILE: main.kt -fun main(a: Defaults, x: Foo): Unit { - a.everythingNotNullable(null).foo() - a.everythingNotNullable(x).foo() - - a.everythingNullable(null).foo() - - a.everythingUnknown(null).foo() - - a.mixed(null).foo() - a.mixed(x).foo() - - a.explicitlyNullnessUnspecified(x).foo() - a.explicitlyNullnessUnspecified(null).foo() - - a.defaultField.foo() - - a.field.foo() -} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt index 50662a54993..66aeaa48b26 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Defaults.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: strict // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt deleted file mode 100644 index 0718769a3b8..00000000000 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.fir.kt +++ /dev/null @@ -1,44 +0,0 @@ -// JSPECIFY_STATE: strict -// !LANGUAGE: +TypeEnhancementImprovementsInStrictMode - -// FILE: IgnoreAnnotations.java -import org.jspecify.nullness.*; - -@NullMarked -public class IgnoreAnnotations { - @Nullable public Derived field = null; - - @Nullable - public Derived foo(Derived x, @NullnessUnspecified Base y) { - return null; - } - - public Derived everythingNotNullable(Derived x) { return null; } - - public @Nullable Derived everythingNullable(@Nullable Derived x) { return null; } - - public @NullnessUnspecified Derived everythingUnknown(@NullnessUnspecified Derived x) { return null; } -} - -// FILE: Base.java -public class Base { - void foo() {} -} - -// FILE: Derived.java -public class Derived extends Base { } - -// FILE: main.kt -fun main(a: IgnoreAnnotations, x: Derived): Unit { - a.foo(x, null).foo() - a.foo(null, x).foo() - - a.field.foo() - - a.everythingNotNullable(null).foo() - a.everythingNotNullable(x).foo() - - a.everythingNullable(null).foo() - - a.everythingUnknown(null).foo() -} diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt index f38f2134711..0d24a58285e 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/IgnoreAnnotations.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: strict // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt index a2e0610a9d4..6becee66f4c 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/NullnessUnspecifiedTypeParameter.fir.kt @@ -15,17 +15,23 @@ public class Test {} // FILE: main.kt fun main(a1: NullnessUnspecifiedTypeParameter, a2: NullnessUnspecifiedTypeParameter, x: Test): Unit { + // jspecify_nullness_mismatch a1.foo(null) a1.foo(1) + // jspecify_nullness_mismatch a2.foo(null) a2.foo(1) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch a1.bar(null, null) + // jspecify_nullness_mismatch a1.bar(x, null) a1.bar(x, 1) + // jspecify_nullness_mismatch, jspecify_nullness_mismatch a2.bar(null, null) + // jspecify_nullness_mismatch a2.bar(x, null) a2.bar(x, 1) } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt index c9539f4bf08..920d69e458c 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/SelfType.fir.kt @@ -39,11 +39,14 @@ public class CKN extends C<@Nullable CK> {} // FILE: main.kt fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit { ak.foo(ak) + // jspecify_nullness_mismatch ak.foo(null) + // jspecify_nullness_mismatch akn.foo(null) bk.foo(bk) + // jspecify_nullness_mismatch bk.foo(null) ck.foo(ck) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt index 028682e0287..084def3eeb7 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.fir.kt @@ -28,10 +28,13 @@ public class Derived extends Base { // FILE: main.kt fun main(a: Simple, x: Derived): Unit { + // jspecify_nullness_mismatch a.foo(x, null).foo() + // jspecify_nullness_mismatch, jspecify_nullness_mismatch a.foo(null, x).foo() a.bar().foo() + // jspecify_nullness_mismatch a.field.foo() } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt index 48e6a4562d3..b51c622f6d4 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/Simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // JSPECIFY_STATE: strict // !LANGUAGE: +TypeEnhancementImprovementsInStrictMode diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt index 367476c1f44..7183ce03b0b 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeArgumentsFromParameterBounds.fir.kt @@ -36,7 +36,9 @@ fun main( ): Unit { a.bar(aNotNullNotNullNotNull) a.bar(aNotNullNotNullNull) + // jspecify_nullness_mismatch a.bar(aNotNullNullNotNull) + // jspecify_nullness_mismatch a.bar(aNotNullNullNull) b.bar(aNotNullNotNullNotNull) diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt index ea635134774..468756217af 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/strictMode/TypeParameterBounds.fir.kt @@ -30,10 +30,12 @@ fun main(a1: A, a2: A, b1: B, b2: B, x: T): U a2.bar(null) a2.bar(x) + // jspecify_nullness_mismatch b1.foo(null) b1.bar(null) b1.bar(x) + // jspecify_nullness_mismatch b2.foo(null) b2.bar(null) b2.bar(x)