From c1a5ce7d109aa7628fa69eaa349d1fa7933d3bdd Mon Sep 17 00:00:00 2001 From: Rick Clephas Date: Wed, 22 Dec 2021 20:00:24 +0100 Subject: [PATCH] Fix issue with recursive call check if only a single SyntheticResolveExtension is registered #28 --- .../compiler/KmpNativeCoroutinesComponentRegistrar.kt | 1 + .../compiler/KmpNativeCoroutinesSyntheticResolveExtension.kt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesComponentRegistrar.kt b/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesComponentRegistrar.kt index 6ce4d94e..b4b15044 100644 --- a/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesComponentRegistrar.kt +++ b/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesComponentRegistrar.kt @@ -13,6 +13,7 @@ class KmpNativeCoroutinesComponentRegistrar: ComponentRegistrar { val suffix = configuration.get(SUFFIX_KEY) ?: return val nameGenerator = NameGenerator(suffix) SyntheticResolveExtension.registerExtension(project, KmpNativeCoroutinesSyntheticResolveExtension(nameGenerator)) + SyntheticResolveExtension.registerExtension(project, KmpNativeCoroutinesSyntheticResolveExtension.RecursiveCallSyntheticResolveExtension()) IrGenerationExtension.registerExtension(project, KmpNativeCoroutinesIrGenerationExtension(nameGenerator)) } } \ No newline at end of file diff --git a/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesSyntheticResolveExtension.kt b/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesSyntheticResolveExtension.kt index 48486f9f..695cb7e0 100644 --- a/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesSyntheticResolveExtension.kt +++ b/kmp-nativecoroutines-compiler/src/main/kotlin/com/rickclephas/kmp/nativecoroutines/compiler/KmpNativeCoroutinesSyntheticResolveExtension.kt @@ -36,6 +36,9 @@ internal class KmpNativeCoroutinesSyntheticResolveExtension( NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS) as MutableSet } + // We need two extensions so that we can check for recursion calls with `syntheticResolveExtensionClassName`. + class RecursiveCallSyntheticResolveExtension : SyntheticResolveExtension + private val syntheticResolveExtensionClassName = "org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension\$Companion\$getInstance\$1"