From df909abaf5344cb55eb0b0258c0060444643fe65 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Mon, 25 Apr 2022 12:38:06 +0300 Subject: [PATCH] [IR][tests] More precise IrLinkageError checks --- .../klibABI/removeClassAsParameterType/main/m.kt | 9 ++++++--- .../testData/klibABI/removeClassAsReturnType/main/m.kt | 9 ++++++--- .../klibABI/removeClassAsSuperTypeArgument/main/m.kt | 9 ++++++--- .../klibABI/removeClassAsTypeArgument/main/m.kt | 9 ++++++--- compiler/testData/klibABI/removeFunction/main/m.kt | 10 ++++++---- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/compiler/testData/klibABI/removeClassAsParameterType/main/m.kt b/compiler/testData/klibABI/removeClassAsParameterType/main/m.kt index 6344bc0c9ca..36d477bded6 100644 --- a/compiler/testData/klibABI/removeClassAsParameterType/main/m.kt +++ b/compiler/testData/klibABI/removeClassAsParameterType/main/m.kt @@ -2,8 +2,8 @@ fun test1(d: D): String { try { d.bar() - } catch(ex: Throwable) { - return "O" + } catch(e: Throwable) { + if (e.isLinkageError("/E.")) return "O" } return "FAIL2" @@ -16,4 +16,7 @@ fun test2(d: D): String { fun box(): String { return test1(D()) + test2(D()) -} \ No newline at end of file +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true diff --git a/compiler/testData/klibABI/removeClassAsReturnType/main/m.kt b/compiler/testData/klibABI/removeClassAsReturnType/main/m.kt index 6344bc0c9ca..d6b501241bd 100644 --- a/compiler/testData/klibABI/removeClassAsReturnType/main/m.kt +++ b/compiler/testData/klibABI/removeClassAsReturnType/main/m.kt @@ -2,8 +2,8 @@ fun test1(d: D): String { try { d.bar() - } catch(ex: Throwable) { - return "O" + } catch(e: Throwable) { + if (e.isLinkageError("/D.exp")) return "O" } return "FAIL2" @@ -16,4 +16,7 @@ fun test2(d: D): String { fun box(): String { return test1(D()) + test2(D()) -} \ No newline at end of file +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true diff --git a/compiler/testData/klibABI/removeClassAsSuperTypeArgument/main/m.kt b/compiler/testData/klibABI/removeClassAsSuperTypeArgument/main/m.kt index 6344bc0c9ca..d6b501241bd 100644 --- a/compiler/testData/klibABI/removeClassAsSuperTypeArgument/main/m.kt +++ b/compiler/testData/klibABI/removeClassAsSuperTypeArgument/main/m.kt @@ -2,8 +2,8 @@ fun test1(d: D): String { try { d.bar() - } catch(ex: Throwable) { - return "O" + } catch(e: Throwable) { + if (e.isLinkageError("/D.exp")) return "O" } return "FAIL2" @@ -16,4 +16,7 @@ fun test2(d: D): String { fun box(): String { return test1(D()) + test2(D()) -} \ No newline at end of file +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true diff --git a/compiler/testData/klibABI/removeClassAsTypeArgument/main/m.kt b/compiler/testData/klibABI/removeClassAsTypeArgument/main/m.kt index 6344bc0c9ca..d6b501241bd 100644 --- a/compiler/testData/klibABI/removeClassAsTypeArgument/main/m.kt +++ b/compiler/testData/klibABI/removeClassAsTypeArgument/main/m.kt @@ -2,8 +2,8 @@ fun test1(d: D): String { try { d.bar() - } catch(ex: Throwable) { - return "O" + } catch(e: Throwable) { + if (e.isLinkageError("/D.exp")) return "O" } return "FAIL2" @@ -16,4 +16,7 @@ fun test2(d: D): String { fun box(): String { return test1(D()) + test2(D()) -} \ No newline at end of file +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true diff --git a/compiler/testData/klibABI/removeFunction/main/m.kt b/compiler/testData/klibABI/removeFunction/main/m.kt index 4d3d948dae3..6f8825bde03 100644 --- a/compiler/testData/klibABI/removeFunction/main/m.kt +++ b/compiler/testData/klibABI/removeFunction/main/m.kt @@ -1,9 +1,8 @@ - fun test1(): String { try { return qux(true) - } catch(ex: Throwable) { - return "O" + } catch(e: Throwable) { + if (e.isLinkageError("/exp_foo")) return "O" } return "FAIL2" @@ -13,4 +12,7 @@ fun test2(): String = qux(false) fun box(): String { return test1() + test2() -} \ No newline at end of file +} + +private fun Throwable.isLinkageError(symbolName: String): Boolean = + this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true