FIR Java: fix conversion of primitive type

This commit is contained in:
Mikhail Glukhikh
2021-08-26 10:33:14 +03:00
committed by TeamCityServer
parent a12e31daf1
commit 020b6e9dd1
2 changed files with 18 additions and 9 deletions
@@ -776,13 +776,22 @@ private fun FirConstExpression<*>.setProperType(session: FirSession): FirConstEx
private fun JavaType.toFirResolvedTypeRef(
session: FirSession, javaTypeParameterStack: JavaTypeParameterStack
): FirResolvedTypeRef {
if (this is JavaClassifierType) return toFirResolvedTypeRef(
session,
javaTypeParameterStack,
isForSupertypes = false,
forTypeParameterBounds = false
)
return buildResolvedTypeRef {
type = ConeClassErrorType(ConeSimpleDiagnostic("Unexpected JavaType: $this", DiagnosticKind.Java))
return when (this) {
is JavaClassifierType -> toFirResolvedTypeRef(
session,
javaTypeParameterStack,
isForSupertypes = false,
forTypeParameterBounds = false
)
is JavaPrimitiveType -> buildResolvedTypeRef {
type = toConeKotlinTypeWithoutEnhancement(
session,
javaTypeParameterStack,
)
this@toFirResolvedTypeRef.annotations.mapTo(annotations) { it.toFirAnnotationCall(session, javaTypeParameterStack) }
}
else -> buildResolvedTypeRef {
type = ConeClassErrorType(ConeSimpleDiagnostic("Unexpected JavaType: ${this@toFirResolvedTypeRef}", DiagnosticKind.Java))
}
}
}
@@ -5,7 +5,7 @@ public open class ClassObjectArrayInParam : R|kotlin/Any| {
public constructor(vararg value: R|kotlin/Array<kotlin/reflect/KClass<*>>|): R|test/ClassObjectArrayInParam.Anno|
}
@R|test/ClassObjectArrayInParam.Anno|(<implicitArrayOf>(<getClass>(<getClass>(R|ft<test/ClassObjectArrayInParam, test/ClassObjectArrayInParam?>|)), <getClass>(<getClass>(R|ft<test/ClassObjectArrayInParam.Nested, test/ClassObjectArrayInParam.Nested?>|)), <getClass>(<getClass>(R|ft<kotlin/String, kotlin/String?>|)), <getClass>(<getClass>(R|ft<kotlin/collections/MutableList<kotlin/Any?>, kotlin/collections/List<*>?>|)), <getClass>(<getClass>(R|ERROR CLASS: Unexpected JavaType: org.jetbrains.kotlin.fir.types.builder.FirResolvedTypeRefBuilder@4abd3f24|)), <getClass>(<getClass>(R|ERROR CLASS: Unexpected JavaType: org.jetbrains.kotlin.fir.types.builder.FirResolvedTypeRefBuilder@6214f104|)), <getClass>(<getClass>(R|ERROR CLASS: Unexpected JavaType: org.jetbrains.kotlin.fir.types.builder.FirResolvedTypeRefBuilder@5450f4f|)))) public open class Nested : R|kotlin/Any| {
@R|test/ClassObjectArrayInParam.Anno|(<implicitArrayOf>(<getClass>(<getClass>(R|ft<test/ClassObjectArrayInParam, test/ClassObjectArrayInParam?>|)), <getClass>(<getClass>(R|ft<test/ClassObjectArrayInParam.Nested, test/ClassObjectArrayInParam.Nested?>|)), <getClass>(<getClass>(R|ft<kotlin/String, kotlin/String?>|)), <getClass>(<getClass>(R|ft<kotlin/collections/MutableList<kotlin/Any?>, kotlin/collections/List<*>?>|)), <getClass>(<getClass>(R|ERROR CLASS: Unexpected JavaType: JavaArrayTypeImpl: PsiType:String[][]|)), <getClass>(<getClass>(R|ERROR CLASS: Unexpected JavaType: JavaArrayTypeImpl: PsiType:int[][]|)), <getClass>(<getClass>(R|kotlin/Unit|)))) public open class Nested : R|kotlin/Any| {
public constructor(): R|test/ClassObjectArrayInParam.Nested|
}