K2: add & fix tests for JVM BE diagnostics

This commit is contained in:
Mikhail Glukhikh
2022-10-14 09:46:22 +02:00
committed by Space Team
parent 185e74fd26
commit 1826d9b332
34 changed files with 972 additions and 188 deletions
@@ -874,7 +874,7 @@ class ExpressionCodegen(
private fun generateGlobalReturnFlagIfPossible(expression: IrExpression, label: String) {
if (state.isInlineDisabled) {
context.ktDiagnosticReporter.at(expression, irFunction).report(BackendErrors.NON_LOCAL_RETURN_IN_DISABLED_INLINE)
context.ktDiagnosticReporter.at(expression, irFunction).reportAndCommit(BackendErrors.NON_LOCAL_RETURN_IN_DISABLED_INLINE)
genThrow(mv, "java/lang/UnsupportedOperationException", "Non-local returns are not allowed with inlining disabled")
} else {
generateGlobalReturnFlag(mv, label)
@@ -119,12 +119,12 @@ class IrInlineIntrinsicsSupport(
override fun toKotlinType(type: IrType): KotlinType = type.toIrBasedKotlinType()
override fun reportSuspendTypeUnsupported() {
classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile).report(JvmBackendErrors.TYPEOF_SUSPEND_TYPE)
classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile).reportAndCommit(JvmBackendErrors.TYPEOF_SUSPEND_TYPE)
}
override fun reportNonReifiedTypeParameterWithRecursiveBoundUnsupported(typeParameterName: Name) {
classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile)
.report(JvmBackendErrors.TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, typeParameterName.asString())
.reportAndCommit(JvmBackendErrors.TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, typeParameterName.asString())
}
override fun rewritePluginDefinedOperationMarker(v: InstructionAdapter, reifiedInsn: AbstractInsnNode, instructions: InsnList, type: IrType): Boolean {
@@ -129,7 +129,7 @@ class IrSourceCompilerForInline(
override fun reportSuspensionPointInsideMonitor(stackTraceElement: String) {
codegen.context.ktDiagnosticReporter
.at(callElement.symbol.owner as IrDeclaration)
.report(JvmBackendErrors.SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
.reportAndCommit(JvmBackendErrors.SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
}
}