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
}
@OptIn(ExperimentalStdlibApi::class)
private fun enhanceTypeArguments(arguments: List<TypeProjection>) =
buildList {
for (argument in arguments) {
// TODO: think about star projections with enhancement (e.g. came from Java: Foo<@NotNull ?>)
if (argument.isStarProjection) continue
val argumentType = argument.type
val enhancedArgumentType = if (argumentType is TypeWithEnhancement) argumentType.enhancement else argumentType
val enhancedDeeplyArgumentType = buildTypeWithEnhancement(enhancedArgumentType)
add(argument.replaceType(enhancedDeeplyArgumentType))
arguments.map { argument ->
// TODO: think about star projections with enhancement (e.g. came from Java: Foo<@NotNull ?>)
if (argument.isStarProjection) {
return@map argument
}
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 {