[FIR] Improve readability of rendered types in diagnostics

#KT-61824 Fixed
#KT-61688 Fixed
This commit is contained in:
Kirill Rakhman
2023-09-12 14:27:29 +02:00
committed by Space Team
parent 99b852adf8
commit 4e1dfcd2a8
25 changed files with 65 additions and 37 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
b.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
b.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jspecifyUsage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jspecifyUsage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
a.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jspecifyUsage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jspecifyUsage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
a.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jsr305DefaultMigration.kt:2:19: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305DefaultMigration.kt:2:19: error: null cannot be a value of a non-null type 'kotlin/String'.
annotated.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,6 +1,6 @@
warning: argument -Xjsr305-annotations is deprecated. Please use -Xjsr305 instead
warning: option 'enable' for -Xjsr305 flag is deprecated. Please use 'strict' instead
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
a.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type 'kotlin/String'.
annotated.bar(null)
^
COMPILATION_ERROR
+2 -2
View File
@@ -1,7 +1,7 @@
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Migration.kt:2:19: error: null cannot be a value of a non-null type 'kotlin/String'.
annotated.foo(null)
^
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type 'kotlin/String'.
annotated.bar(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Migration.kt:3:19: error: null cannot be a value of a non-null type 'kotlin/String'.
annotated.bar(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/jsr305Usage.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
a.foo(null)
^
COMPILATION_ERROR
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/severalAnnotations.kt:2:11: error: null cannot be a value of a non-null type '@EnhancedNullability kotlin/String'.
compiler/testData/cli/jvm/severalAnnotations.kt:2:11: error: null cannot be a value of a non-null type 'kotlin/String'.
a.foo(null)
^
COMPILATION_ERROR
@@ -12,14 +12,14 @@ annotation class Ann
fun <@Ann R : @Ann Any> f3(a: Array<@Ann R>): Array<@Ann R?> = null!!
fun test2(a: @Ann Array<in @Ann Int>) {
val r: Array<in Int?> = f3(<!ARGUMENT_TYPE_MISMATCH("kotlin/Array<@R|Ann|() R>; @R|Ann|() kotlin/Array<CapturedType(in @R|Ann|() kotlin/Int)>")!>a<!>)
val r: Array<in Int?> = f3(<!ARGUMENT_TYPE_MISMATCH("kotlin/Array<@Ann() R>; @Ann() kotlin/Array<CapturedType(in @Ann() kotlin/Int)>")!>a<!>)
}
var test3: Int = 0
set(s: <!WRONG_SETTER_PARAMETER_TYPE("kotlin/Int; @R|Ann|() kotlin/String")!>@Ann String<!>) {}
set(s: <!WRONG_SETTER_PARAMETER_TYPE("kotlin/Int; @Ann() kotlin/String")!>@Ann String<!>) {}
fun f4(fn: (@Ann Int, @Ann Int) -> Unit) {}
val test4 = f4 <!ARGUMENT_TYPE_MISMATCH("kotlin/Function2<@R|Ann|() kotlin/Int, @R|Ann|() kotlin/Int, kotlin/Unit>; kotlin/Function1<@R|Ann|() kotlin/Int, kotlin/Unit>")!>{ single -> }<!>
val test4 = f4 <!ARGUMENT_TYPE_MISMATCH("kotlin/Function2<@Ann() kotlin/Int, @Ann() kotlin/Int, kotlin/Unit>; kotlin/Function1<@Ann() kotlin/Int, kotlin/Unit>")!>{ single -> }<!>
@@ -11,5 +11,5 @@ class C<T> {
}
fun test(a: C<out CharSequence>) {
a[1] = <!ARGUMENT_TYPE_MISMATCH("@R|A|() CapturedType(out kotlin/CharSequence); kotlin/Int")!>25<!>
a[1] = <!ARGUMENT_TYPE_MISMATCH("@A() CapturedType(out kotlin/CharSequence); kotlin/Int")!>25<!>
}
@@ -13,5 +13,5 @@ class C<T> {
class Out<out F>
fun test(a: C<out CharSequence>, y: Out<CharSequence>) {
a + <!ARGUMENT_TYPE_MISMATCH("Out<@R|A|() CapturedType(out kotlin/CharSequence)>; Out<kotlin/CharSequence>")!>y<!>
a + <!ARGUMENT_TYPE_MISMATCH("Out<@A() CapturedType(out kotlin/CharSequence)>; Out<kotlin/CharSequence>")!>y<!>
}
@@ -17,7 +17,7 @@ interface A {
interface B : A {
override val p1: <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE("p1; @An() val p1: @R|An|() String")!>Int<!>
@An
override <!VAR_OVERRIDDEN_BY_VAL("public abstract override val /B.p2: @R|An|() kotlin/String public get(): @R|An|() kotlin/String; public abstract var /A.p2: @R|An|() kotlin/String public get(): @R|An|() kotlin/String public set(value: @R|An|() kotlin/String): kotlin/Unit")!>val<!> p2: @An String
override <!VAR_OVERRIDDEN_BY_VAL("public abstract override val /B.p2: @An() kotlin/String public get(): @An() kotlin/String; public abstract var /A.p2: @An() kotlin/String public get(): @An() kotlin/String public set(value: @An() kotlin/String): kotlin/Unit")!>val<!> p2: @An String
override fun test(arg: String): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE("test; @An() fun test(@An() arg: @R|An|() String): @R|An|() String")!>Int<!>
}
@@ -30,7 +30,7 @@ fun testYield() {
val buildee = build {
yield { val x: UserKlass = this<!UNRESOLVED_LABEL!>@yield<!> }
}
checkExactType<Buildee<UserKlass.() -> Unit>>(<!ARGUMENT_TYPE_MISMATCH("Buildee<@ExtensionFunctionType kotlin/Function1<UserKlass, kotlin/Unit>>; Buildee<kotlin/Function0<kotlin/Unit>>")!>buildee<!>)
checkExactType<Buildee<UserKlass.() -> Unit>>(<!ARGUMENT_TYPE_MISMATCH("Buildee<kotlin/Function1<UserKlass, kotlin/Unit>>; Buildee<kotlin/Function0<kotlin/Unit>>")!>buildee<!>)
}
// test 2: PTV is in producing position (materialize-case)
@@ -42,5 +42,5 @@ fun testMaterialize() {
materialize()
)
}
checkExactType<Buildee<UserKlass.() -> Unit>>(<!ARGUMENT_TYPE_MISMATCH("Buildee<@ExtensionFunctionType kotlin/Function1<UserKlass, kotlin/Unit>>; Buildee<kotlin/Function0<kotlin/Unit>>")!>buildee<!>)
checkExactType<Buildee<UserKlass.() -> Unit>>(<!ARGUMENT_TYPE_MISMATCH("Buildee<kotlin/Function1<UserKlass, kotlin/Unit>>; Buildee<kotlin/Function0<kotlin/Unit>>")!>buildee<!>)
}
@@ -1,7 +1,7 @@
/main.kt:(98,103): error: Argument type mismatch: actual type is 'V', but '@EnhancedNullability V & Any' was expected.
/main.kt:(98,103): error: Argument type mismatch: actual type is 'V', but 'V & Any' was expected.
/main.kt:(119,120): error: Argument type mismatch: actual type is 'kotlin/collections/List<V>', but 'ft<@EnhancedNullability kotlin/collections/MutableList<@EnhancedNullability @R|org/jetbrains/annotations/NotNull|() V & Any>, @EnhancedNullability kotlin/collections/List<@EnhancedNullability @R|org/jetbrains/annotations/NotNull|() V & Any>>' was expected.
/main.kt:(119,120): error: Argument type mismatch: actual type is 'kotlin/collections/List<V>', but 'kotlin/collections/(Mutable)List<@NotNull() V & Any>' was expected.
/main.kt:(133,138): error: Argument type mismatch: actual type is 'V', but '@EnhancedNullability E & Any' was expected.
/main.kt:(133,138): error: Argument type mismatch: actual type is 'V', but 'E & Any' was expected.
/main.kt:(154,155): error: Argument type mismatch: actual type is 'kotlin/collections/List<V>', but 'ft<@EnhancedNullability kotlin/collections/MutableList<@EnhancedNullability @R|org/jetbrains/annotations/NotNull|() E & Any>, @EnhancedNullability kotlin/collections/List<@EnhancedNullability @R|org/jetbrains/annotations/NotNull|() E & Any>>' was expected.
/main.kt:(154,155): error: Argument type mismatch: actual type is 'kotlin/collections/List<V>', but 'kotlin/collections/(Mutable)List<@NotNull() E & Any>' was expected.