From d30d76bf126268180e08931875ece5cb60bb499a Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 3 Feb 2020 11:01:11 +0300 Subject: [PATCH] Better error reporting in interop lowering. (#3814) --- .../jetbrains/kotlin/backend/konan/lower/InteropLowering.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt index f8dc2d8ef9e..37ae52387c0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt @@ -875,7 +875,8 @@ private class InteropTransformer(val context: Context, override val irFile: IrFi val function = expression.symbol.owner val inlinedClass = function.returnType.getInlinedClassNative() if (inlinedClass?.descriptor == interop.cPointer || inlinedClass?.descriptor == interop.nativePointed) { - throw Error("Native interop types constructors must not be called directly") + context.reportCompilationError("Native interop types constructors must not be called directly", + irFile, expression) } return expression } @@ -993,7 +994,8 @@ private class InteropTransformer(val context: Context, override val irFile: IrFi irFile, expression) } - else -> throw Error() + else -> context.reportCompilationError("unexpected intrinsic $intrinsicType", + irFile, expression) } val receiverClass = symbols.integerClasses.single {