From 0f6084fa66f95b1f2dbdd4be5143964fbff4de37 Mon Sep 17 00:00:00 2001 From: Jiaxiang Chen Date: Thu, 17 Aug 2023 15:23:40 -0700 Subject: [PATCH] add Any to unbounded type parameter --- .../devtools/ksp/impl/symbol/kotlin/KSTypeParameterImpl.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSTypeParameterImpl.kt b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSTypeParameterImpl.kt index 8b2672de33..2187500074 100644 --- a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSTypeParameterImpl.kt +++ b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSTypeParameterImpl.kt @@ -18,7 +18,9 @@ package com.google.devtools.ksp.impl.symbol.kotlin import com.google.devtools.ksp.KSObjectCache +import com.google.devtools.ksp.impl.ResolverAAImpl import com.google.devtools.ksp.processing.impl.KSNameImpl +import com.google.devtools.ksp.processing.impl.KSTypeReferenceSyntheticImpl import com.google.devtools.ksp.symbol.* import org.jetbrains.kotlin.analysis.api.symbols.KtTypeParameterSymbol @@ -48,6 +50,10 @@ class KSTypeParameterImpl private constructor(internal val ktTypeParameterSymbol override val bounds: Sequence by lazy { ktTypeParameterSymbol.upperBounds.asSequence().mapIndexed { index, type -> KSTypeReferenceImpl.getCached(type, this@KSTypeParameterImpl, index) + }.ifEmpty { + sequenceOf( + KSTypeReferenceSyntheticImpl.getCached(ResolverAAImpl.instance.builtIns.anyType.makeNullable(), this) + ) } }