[FIR2IR] Return fallback mode for annotation resolved placeholder

This commit is contained in:
Mikhail Glukhikh
2020-07-30 11:08:01 +03:00
parent b63257345b
commit 8379b3794a
6 changed files with 13 additions and 5 deletions
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.references.FirReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.references.FirSuperReference import org.jetbrains.kotlin.fir.references.FirSuperReference
import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.resolve.buildUseSiteMemberScope
import org.jetbrains.kotlin.fir.resolve.calls.isFunctional import org.jetbrains.kotlin.fir.resolve.calls.isFunctional
import org.jetbrains.kotlin.fir.resolve.inference.isBuiltinFunctionalType import org.jetbrains.kotlin.fir.resolve.inference.isBuiltinFunctionalType
import org.jetbrains.kotlin.fir.resolve.inference.isSuspendFunctionType import org.jetbrains.kotlin.fir.resolve.inference.isSuspendFunctionType
@@ -428,6 +429,18 @@ class CallAndReferenceGenerator(
val irClass = symbol.owner val irClass = symbol.owner
val irConstructor = (annotationCall.toResolvedCallableSymbol() as? FirConstructorSymbol)?.let { val irConstructor = (annotationCall.toResolvedCallableSymbol() as? FirConstructorSymbol)?.let {
this.declarationStorage.getIrConstructorSymbol(it) this.declarationStorage.getIrConstructorSymbol(it)
} ?: run {
// Fallback for FirReferencePlaceholderForResolvedAnnotations from jar
val fir = coneType.lookupTag.toSymbol(session)?.fir as? FirClass<*>
var constructorSymbol: FirConstructorSymbol? = null
fir?.buildUseSiteMemberScope(session, scopeSession)?.processDeclaredConstructors {
if (it.fir.isPrimary && constructorSymbol == null) {
constructorSymbol = it
}
}
constructorSymbol?.let {
this.declarationStorage.getIrConstructorSymbol(it)
}
} }
if (irConstructor == null) { if (irConstructor == null) {
IrErrorCallExpressionImpl(startOffset, endOffset, type, "No annotation constructor found: ${irClass.name}") IrErrorCallExpressionImpl(startOffset, endOffset, type, "No annotation constructor found: ${irClass.name}")
@@ -1,6 +1,5 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS // KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// WITH_REFLECT // WITH_REFLECT
// FULL_JDK // FULL_JDK
@@ -1,5 +1,4 @@
// !LANGUAGE: +PolymorphicSignature // !LANGUAGE: +PolymorphicSignature
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FULL_JDK // FULL_JDK
// SKIP_JDK6 // SKIP_JDK6
@@ -1,5 +1,4 @@
// !LANGUAGE: +PolymorphicSignature // !LANGUAGE: +PolymorphicSignature
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FULL_JDK // FULL_JDK
// SKIP_JDK6 // SKIP_JDK6
@@ -1,5 +1,4 @@
// !LANGUAGE: +PolymorphicSignature // !LANGUAGE: +PolymorphicSignature
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FULL_JDK // FULL_JDK
// SKIP_JDK6 // SKIP_JDK6
@@ -1,5 +1,4 @@
// !LANGUAGE: +PolymorphicSignature // !LANGUAGE: +PolymorphicSignature
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FULL_JDK // FULL_JDK
// SKIP_JDK6 // SKIP_JDK6