From 447f7233b3ca1476e000136a3941bc4ca376e3e0 Mon Sep 17 00:00:00 2001 From: Denis Stepanov Date: Mon, 4 Dec 2023 14:58:10 +0100 Subject: [PATCH] KSP: Resolved type arguments shouldn't be marked as a type variable (#10193) --- .../visitor/KotlinTypeArgumentElement.kt | 2 +- .../beans/BeanDefinitionSpec.groovy | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/inject-kotlin/src/main/kotlin/io/micronaut/kotlin/processing/visitor/KotlinTypeArgumentElement.kt b/inject-kotlin/src/main/kotlin/io/micronaut/kotlin/processing/visitor/KotlinTypeArgumentElement.kt index 02090340a9a..4d1b8b02279 100644 --- a/inject-kotlin/src/main/kotlin/io/micronaut/kotlin/processing/visitor/KotlinTypeArgumentElement.kt +++ b/inject-kotlin/src/main/kotlin/io/micronaut/kotlin/processing/visitor/KotlinTypeArgumentElement.kt @@ -36,7 +36,7 @@ internal class KotlinTypeArgumentElement( resolved.resolvedTypeArguments, visitorContext, internalArrayDimensions, - true + false ), GenericElement { private val resolvedTypeAnnotationMetadata: ElementAnnotationMetadata by lazy { diff --git a/inject-kotlin/src/test/groovy/io/micronaut/kotlin/processing/beans/BeanDefinitionSpec.groovy b/inject-kotlin/src/test/groovy/io/micronaut/kotlin/processing/beans/BeanDefinitionSpec.groovy index 489f5e5cbf0..ad48ca138bb 100644 --- a/inject-kotlin/src/test/groovy/io/micronaut/kotlin/processing/beans/BeanDefinitionSpec.groovy +++ b/inject-kotlin/src/test/groovy/io/micronaut/kotlin/processing/beans/BeanDefinitionSpec.groovy @@ -1116,13 +1116,13 @@ interface Deserializer { def deserializerTypeParam = definition.getTypeArguments("test.Deserializer")[0] then: "The first is a placeholder" - serdeTypeParam.isTypeVariable() // - (serdeTypeParam instanceof GenericPlaceholder) + !serdeTypeParam.isTypeVariable() + !(serdeTypeParam instanceof GenericPlaceholder) and: "threat resolved placeholder as not a type variable" - serializerTypeParam.isTypeVariable() - (serializerTypeParam instanceof GenericPlaceholder) - deserializerTypeParam.isTypeVariable() - (deserializerTypeParam instanceof GenericPlaceholder) + !serializerTypeParam.isTypeVariable() + !(serializerTypeParam instanceof GenericPlaceholder) + !deserializerTypeParam.isTypeVariable() + !(deserializerTypeParam instanceof GenericPlaceholder) } void "test isTypeVariable array"() { @@ -1156,15 +1156,15 @@ interface Deserializer { // Arrays are not resolved as KotlinClassElements or placeholders then: "The first is a placeholder" serdeTypeParam.simpleName == "String[]" - serdeTypeParam.isTypeVariable() - (serdeTypeParam instanceof GenericPlaceholder) + !serdeTypeParam.isTypeVariable() + !(serdeTypeParam instanceof GenericPlaceholder) and: "threat resolved placeholder as not a type variable" serializerTypeParam.simpleName == "String[]" - serializerTypeParam.isTypeVariable() - (serializerTypeParam instanceof GenericPlaceholder) + !serializerTypeParam.isTypeVariable() + !(serializerTypeParam instanceof GenericPlaceholder) deserializerTypeParam.simpleName == "String[]" - deserializerTypeParam.isTypeVariable() - (deserializerTypeParam instanceof GenericPlaceholder) + !deserializerTypeParam.isTypeVariable() + !(deserializerTypeParam instanceof GenericPlaceholder) } void "test inline class return type"() {