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<*>? =