Kotlin: fix wildcard suppression where the annotation applies to a parent type/argument.

In the process I also fix the missed case where suppression can be switched off using a parameterized annotation.
This commit is contained in:
Chris Smowton
2022-10-27 17:30:37 +01:00
parent 2796d60d79
commit 24f87ac963
5 changed files with 30 additions and 11 deletions

View File

@@ -691,7 +691,7 @@ open class KotlinFileExtractor(
null
} ?: vp.type
val javaType = (vp.parent as? IrFunction)?.let { getJavaCallable(it)?.let { jCallable -> getJavaValueParameterType(jCallable, idx) } }
val typeWithWildcards = addJavaLoweringWildcards(maybeAlteredType, !hasWildcardSuppressionAnnotation(vp), javaType)
val typeWithWildcards = addJavaLoweringWildcards(maybeAlteredType, !getInnermostWildcardSupppressionAnnotation(vp), javaType)
val substitutedType = typeSubstitution?.let { it(typeWithWildcards, TypeContext.OTHER, pluginContext) } ?: typeWithWildcards
val id = useValueParameter(vp, parent)
if (extractTypeAccess) {