From 6b003c49503571c89feadfd8376710e6611dabbc Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Sat, 7 Oct 2023 08:39:38 +0200 Subject: [PATCH] Small correction to `resolveConeTypeProjection()` --- src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt index 9a894098c..4539a1ee3 100644 --- a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt +++ b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt @@ -1083,11 +1083,9 @@ class KotlinTypeMapping(typeCache: JavaTypeCache, firSession: FirSession) : Java for (bound: FirTypeRef in typeParameter.bounds) { bounds.add(type(bound)) } - if ("out" == typeParameter.variance.label) { - variance = JavaType.GenericTypeVariable.Variance.COVARIANT - } else if ("in" == typeParameter.variance.label) { + if (typeParameter.variance == Variance.IN_VARIANCE) { variance = JavaType.GenericTypeVariable.Variance.CONTRAVARIANT - } else { + } else if (bounds.isNotEmpty()) { variance = JavaType.GenericTypeVariable.Variance.COVARIANT } }