KAPT+IR: support IR error types

#KT-49682
This commit is contained in:
Mikhael Bogdanov
2022-05-27 13:39:57 +02:00
committed by Space
parent 41d6f0dca4
commit 162ca4ac2b
21 changed files with 290 additions and 25 deletions
@@ -216,7 +216,7 @@ abstract class AnnotationCodegen(
genCompileTimeValue(getAnnotationArgumentJvmName(annotationClass, param.name), value, annotationVisitor)
else if (param.defaultValue != null)
continue // Default value will be supplied by JVM at runtime.
else
else if (context.state.classBuilderMode.generateBodies) //skip error for KAPT
error("No value for annotation parameter $param")
}
}
@@ -89,7 +89,7 @@ val IrType.erasedUpperBound: IrClass
is IrClassSymbol -> classifier.owner
is IrTypeParameterSymbol -> classifier.owner.erasedUpperBound
is IrScriptSymbol -> classifier.owner.targetClass!!.owner
else -> error(render())
else -> if (this is IrErrorType) symbol.owner else error(render())
}
/**
@@ -132,6 +132,11 @@ class IrTypeMapper(private val context: JvmBackendContext) : KotlinTypeMapperBas
): Type = AbstractTypeMapper.mapType(this, type, mode, sw)
override fun JvmSignatureWriter.writeGenericType(type: KotlinTypeMarker, asmType: Type, mode: TypeMappingMode) {
if (type is IrErrorType) {
writeAsmType(asmType)
return
}
if (type !is IrSimpleType) return
if (skipGenericSignature() || hasNothingInNonContravariantPosition(type) || type.arguments.isEmpty() || type.isRawTypeImpl()) {
writeAsmType(asmType)