aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-03-12 10:56:17 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-12 10:59:46 +0100
commitdfe0059b242bd490d006f8304926f559362eb5e9 (patch)
tree9583c9b9a9557298694aae7e82b088dba8e0f40e /plugins/base/src
parent18bada290ab8ebdbf6f5e43d9c3415dd5225227d (diff)
downloaddokka-dfe0059b242bd490d006f8304926f559362eb5e9.tar.gz
dokka-dfe0059b242bd490d006f8304926f559362eb5e9.tar.bz2
dokka-dfe0059b242bd490d006f8304926f559362eb5e9.zip
Fixing variance in psi parsing
Diffstat (limited to 'plugins/base/src')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 8bf556af..65f94843 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -260,7 +260,17 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
}
}
- private fun getProjection(type: PsiType): Projection = if (type is PsiEllipsisType) Star else getBound(type)
+ private fun getVariance(type: PsiWildcardType): Projection = when {
+ type.extendsBound != PsiType.NULL -> Variance(Variance.Kind.Out, getBound(type.extendsBound))
+ type.superBound != PsiType.NULL -> Variance(Variance.Kind.In, getBound(type.superBound))
+ else -> throw IllegalStateException("${type.presentableText} has incorrect bounds")
+ }
+
+ private fun getProjection(type: PsiType): Projection = when (type) {
+ is PsiEllipsisType -> Star
+ is PsiWildcardType -> getVariance(type)
+ else -> getBound(type)
+ }
private fun PsiModifierListOwner.getModifier() = when {
hasModifier(JvmModifier.ABSTRACT) -> JavaModifier.Abstract