From c421bc63901ce11dda0dde38220f4a2a81f57da4 Mon Sep 17 00:00:00 2001 From: manu Date: Mon, 4 Mar 2024 21:02:51 +0100 Subject: [PATCH] Fix findClassifierForKey --- .../kotlin/com/ivianuu/injekt/compiler/InjektUtil.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/compiler/src/main/kotlin/com/ivianuu/injekt/compiler/InjektUtil.kt b/compiler/src/main/kotlin/com/ivianuu/injekt/compiler/InjektUtil.kt index 46c339f37..47a5c06a2 100644 --- a/compiler/src/main/kotlin/com/ivianuu/injekt/compiler/InjektUtil.kt +++ b/compiler/src/main/kotlin/com/ivianuu/injekt/compiler/InjektUtil.kt @@ -133,15 +133,13 @@ fun findClassifierForKey( ctx: InjektContext, ): FirClassifierSymbol<*> = ctx.cached("classifier_for_key", classifierKey) { findClassifierForFqName(classifierFqName, ctx) - ?: (findClassifierForFqName(classifierFqName.parent(), ctx) - ?.typeParameterSymbols - ?: collectDeclarationsInFqName(classifierFqName.parent().parent(), ctx) - .filterIsInstance>() - .filter { it.name == classifierFqName.parent().shortName() } - .flatMap { it.typeParameterSymbols }) + ?: collectDeclarationsInFqName(classifierFqName.parent().parent(), ctx) + .filter { it.fqName.shortName() == classifierFqName.parent().shortName() } + .flatMap { it.typeParameterSymbols ?: emptyList() } .singleOrNull { it.uniqueKey(ctx) == classifierKey } ?: error("Could not find classifier for $classifierKey $classifierFqName " + - "${collectDeclarationsInFqName(classifierFqName.parent(), ctx).map { it.uniqueKey(ctx) }}") + "${collectDeclarationsInFqName(classifierFqName.parent(), ctx).map { it.uniqueKey(ctx) }} " + + "${collectDeclarationsInFqName(classifierFqName.parent().parent(), ctx).map { it.uniqueKey(ctx) }}") } fun findClassifierForFqName(fqName: FqName, ctx: InjektContext): FirClassifierSymbol<*>? =