Add missed type arguments for a star projection into the enhanced type arguments list

This commit is contained in:
Victor Petukhov
2020-12-28 13:39:28 +03:00
parent 531ba4bb48
commit 27dd9484ba
@@ -254,17 +254,17 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
null null
} }
@OptIn(ExperimentalStdlibApi::class)
private fun enhanceTypeArguments(arguments: List<TypeProjection>) = private fun enhanceTypeArguments(arguments: List<TypeProjection>) =
buildList { arguments.map { argument ->
for (argument in arguments) { // TODO: think about star projections with enhancement (e.g. came from Java: Foo<@NotNull ?>)
// TODO: think about star projections with enhancement (e.g. came from Java: Foo<@NotNull ?>) if (argument.isStarProjection) {
if (argument.isStarProjection) continue return@map argument
val argumentType = argument.type
val enhancedArgumentType = if (argumentType is TypeWithEnhancement) argumentType.enhancement else argumentType
val enhancedDeeplyArgumentType = buildTypeWithEnhancement(enhancedArgumentType)
add(argument.replaceType(enhancedDeeplyArgumentType))
} }
val argumentType = argument.type
val enhancedArgumentType = if (argumentType is TypeWithEnhancement) argumentType.enhancement else argumentType
val enhancedDeeplyArgumentType = buildTypeWithEnhancement(enhancedArgumentType)
argument.replaceType(enhancedDeeplyArgumentType)
} }
fun buildTypeWithEnhancement(type: KotlinType): KotlinType { fun buildTypeWithEnhancement(type: KotlinType): KotlinType {