[K2] Disappeared KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE
^KT-59992
This commit is contained in:
committed by
Space Team
parent
1d461684ae
commit
86e175bbf1
+14
-5
@@ -29,12 +29,21 @@ object FirKClassWithIncorrectTypeArgumentChecker : FirCallableDeclarationChecker
|
||||
val source = declaration.source ?: return
|
||||
if (source.kind is KtFakeSourceElementKind) return
|
||||
|
||||
val returnType = declaration.returnTypeRef.coneType
|
||||
if (!returnType.isKClassTypeWithErrorOrNullableArgument(context.session.typeContext)) return
|
||||
val typeArgumentsWithWrongType = mutableListOf<ConeKotlinType>()
|
||||
|
||||
val typeArgument = (returnType.typeArguments[0] as ConeKotlinTypeProjection).type
|
||||
typeArgument.typeParameterFromError?.let {
|
||||
reporter.reportOn(source, FirErrors.KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE, it, context)
|
||||
val returnType = declaration.returnTypeRef.coneType
|
||||
if (returnType.isKClassTypeWithErrorOrNullableArgument(context.session.typeContext)) typeArgumentsWithWrongType.add(returnType)
|
||||
|
||||
returnType.typeArguments.forEach {
|
||||
val type = it.type ?: return@forEach
|
||||
if (type.isKClassTypeWithErrorOrNullableArgument(context.session.typeContext))
|
||||
typeArgumentsWithWrongType.add(type)
|
||||
}
|
||||
|
||||
if (typeArgumentsWithWrongType.isEmpty()) return
|
||||
typeArgumentsWithWrongType.forEach {
|
||||
val typeParameterFromError = (it.typeArguments[0] as? ConeKotlinTypeProjection)?.type?.typeParameterFromError ?: return@forEach
|
||||
reporter.reportOn(source, FirErrors.KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE, typeParameterFromError, context)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -6,7 +6,7 @@ fun <T : Any> test2() = T::class
|
||||
val <T> <!KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE!>test3<!> = T::class
|
||||
val <T> <!KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE!>test4<!> get() = T::class
|
||||
|
||||
fun <T> test5() = listOf(T::class)
|
||||
fun <T> <!KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE!>test5<!>() = listOf(T::class)
|
||||
|
||||
fun <T> test6(): kotlin.reflect.KClass<<!UPPER_BOUND_VIOLATED!>T<!>> = T::class
|
||||
fun <T> test7(): kotlin.reflect.KClass<*> = T::class
|
||||
@@ -14,6 +14,9 @@ fun test8() = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>String?::class<!>
|
||||
|
||||
fun <T> test9() where T : Any?, T : Comparable<T> = T::class
|
||||
|
||||
fun <T, K> mapOf(e: T, b: K): Map<T, K> = null!!
|
||||
fun <T, K> <!KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE, KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE!>test10<!>() = mapOf(T::class, K::class)
|
||||
|
||||
fun <T> listOf(e: T): List<T> = null!!
|
||||
|
||||
fun <L> locals() {
|
||||
|
||||
@@ -14,6 +14,9 @@ fun test8() = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>String?::class<!>
|
||||
|
||||
fun <T> test9() where T : Any?, T : Comparable<T> = T::class
|
||||
|
||||
fun <T, K> mapOf(e: T, b: K): Map<T, K> = null!!
|
||||
fun <T, K> <!KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE!>test10<!>() = mapOf(T::class, K::class)
|
||||
|
||||
fun <T> listOf(e: T): List<T> = null!!
|
||||
|
||||
fun <L> locals() {
|
||||
|
||||
@@ -4,7 +4,9 @@ public val </*0*/ T> test3: kotlin.reflect.KClass<T>
|
||||
public val </*0*/ T> test4: kotlin.reflect.KClass<T>
|
||||
public fun </*0*/ T> listOf(/*0*/ e: T): kotlin.collections.List<T>
|
||||
public fun </*0*/ L> locals(): kotlin.Unit
|
||||
public fun </*0*/ T, /*1*/ K> mapOf(/*0*/ e: T, /*1*/ b: K): kotlin.collections.Map<T, K>
|
||||
public fun </*0*/ T> test1(): kotlin.reflect.KClass<T>
|
||||
public fun </*0*/ T, /*1*/ K> test10(): kotlin.collections.Map<kotlin.reflect.KClass<T>, kotlin.reflect.KClass<K>>
|
||||
public fun </*0*/ T : kotlin.Any> test2(): kotlin.reflect.KClass<T>
|
||||
public fun </*0*/ T> test5(): kotlin.collections.List<kotlin.reflect.KClass<T>>
|
||||
public fun </*0*/ T> test6(): kotlin.reflect.KClass<T>
|
||||
|
||||
Reference in New Issue
Block a user