From 6ae29518503c8626f81e8748aa32693f73e1ba67 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 28 Sep 2020 16:53:06 +0200 Subject: [PATCH] Minor. Do not check suffix of function for tail-call optimization hit --- .../box/coroutines/tailCallOptimizations/returnInlineClass.kt | 2 +- .../tests/org/jetbrains/kotlin/TestHelperGenerator.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/returnInlineClass.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/returnInlineClass.kt index b71457d36fa..5a8c0b9fdd8 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/returnInlineClass.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/returnInlineClass.kt @@ -34,6 +34,6 @@ fun box(): String { val channel: Channel = AbstractChannel() res = channel.receiveOrClosed().holder as String } - TailCallOptimizationChecker.checkStateMachineIn("receiveOrClosed-v5DwqjU") + TailCallOptimizationChecker.checkStateMachineIn("receiveOrClosed") return res } \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt index c1fdd97be92..7f9b7982256 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/TestHelperGenerator.kt @@ -146,12 +146,12 @@ fun createTextForCoroutineHelpers(isReleaseCoroutines: Boolean, checkStateMachin } fun checkNoStateMachineIn(method: String) { - stackTrace.find { it?.methodName == method }?.let { error("tail-call optimization miss: method at " + it + " has state-machine " + + stackTrace.find { it?.methodName?.startsWith(method) == true }?.let { error("tail-call optimization miss: method at " + it + " has state-machine " + stackTrace.joinToString(separator = "\n")) } } fun checkStateMachineIn(method: String) { - stackTrace.find { it?.methodName == method } ?: error("tail-call optimization hit: method " + method + " has not state-machine " + + stackTrace.find { it?.methodName?.startsWith(method) == true } ?: error("tail-call optimization hit: method " + method + " has no state-machine " + stackTrace.joinToString(separator = "\n")) } }