AA: pass wildcard suppression hints on declarations
^KT-61734
This commit is contained in:
@@ -13,7 +13,9 @@ import org.jetbrains.kotlin.name.JvmStandardClassIds.JVM_SUPPRESS_WILDCARDS_ANNO
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
|
||||
fun TypeMappingMode.updateArgumentModeFromAnnotations(
|
||||
type: KotlinTypeMarker, typeSystem: TypeSystemCommonBackendContext
|
||||
type: KotlinTypeMarker,
|
||||
typeSystem: TypeSystemCommonBackendContext,
|
||||
suppressWildcardsByContainingDeclaration: Boolean? = null,
|
||||
): TypeMappingMode {
|
||||
type.suppressWildcardsMode(typeSystem)?.let {
|
||||
return TypeMappingMode.createWithConstantDeclarationSiteWildcardsMode(
|
||||
@@ -34,6 +36,20 @@ fun TypeMappingMode.updateArgumentModeFromAnnotations(
|
||||
)
|
||||
}
|
||||
|
||||
// For example,
|
||||
// @JvmSuppressWildcards(true)
|
||||
// fun deepOpen(x: Out<Out<Out<Open>>>) {}
|
||||
// Instead of the return type, the annotation associated with the declaration indicates that its type signature,
|
||||
// including return type and parameter types, need to suppress wildcards.
|
||||
suppressWildcardsByContainingDeclaration?.let {
|
||||
return TypeMappingMode.createWithConstantDeclarationSiteWildcardsMode(
|
||||
skipDeclarationSiteWildcards = it,
|
||||
isForAnnotationParameter = isForAnnotationParameter,
|
||||
needInlineClassWrapping = needInlineClassWrapping,
|
||||
mapTypeAliases = mapTypeAliases
|
||||
)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user