diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirMissingDependencyClassChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirMissingDependencyClassChecker.kt index b1046b8c972..c104a2e42cc 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirMissingDependencyClassChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirMissingDependencyClassChecker.kt @@ -27,12 +27,19 @@ import org.jetbrains.kotlin.fir.types.* object FirMissingDependencyClassChecker : FirQualifiedAccessExpressionChecker(MppCheckerKind.Common), FirMissingDependencyClassProxy { override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) { val calleeReference = expression.calleeReference + val missingTypes = mutableSetOf() + if (!calleeReference.isError()) { + expression.resolvedType.forEachType { + if (it is ConeErrorType) { + considerType(it, missingTypes, context) + } + } + } + // To replicate K1 behavior, MISSING_DEPENDENCY_CLASS errors should still be reported on error references with a single candidate. // All other callee errors should skip reporting of MISSING_DEPENDENCY_CLASS. - if (calleeReference.isError() && calleeReference.diagnostic !is ConeDiagnosticWithSingleCandidate) return - - val missingTypes = mutableSetOf() + if (calleeReference.isError() && calleeReference.diagnostic !is ConeDiagnosticWithSingleCandidate && missingTypes.isEmpty()) return val symbol = calleeReference.toResolvedCallableSymbol() ?: return considerType(symbol.resolvedReturnTypeRef.coneType, missingTypes, context) diff --git a/compiler/testData/diagnostics/tests/javac/Lambda.fir.diag.txt b/compiler/testData/diagnostics/tests/javac/Lambda.fir.diag.txt index ffdf456334e..9ea11e910f2 100644 --- a/compiler/testData/diagnostics/tests/javac/Lambda.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/javac/Lambda.fir.diag.txt @@ -1,7 +1,17 @@ +/Call.kt:(232,241): error: Cannot access class 'com.result.B'. Check your module classpath for missing or conflicting dependencies. + /Call.kt:(253,262): error: Cannot access class 'com.result.B'. Check your module classpath for missing or conflicting dependencies. +/Call.kt:(271,280): error: Cannot access class 'com.result.B'. Check your module classpath for missing or conflicting dependencies. + /Call.kt:(294,296): error: Cannot access class 'com.result.B'. Check your module classpath for missing or conflicting dependencies. +/Call.kt:(316,334): error: Cannot access class 'com.result.Owner.Nested'. Check your module classpath for missing or conflicting dependencies. + +/Call.kt:(316,334): error: Cannot access class 'com.result.Owner.Nested.VeryNested'. Check your module classpath for missing or conflicting dependencies. + +/Call.kt:(337,345): error: Cannot access class 'com.result.Owner.Nested'. Check your module classpath for missing or conflicting dependencies. + /Call.kt:(346,355): error: Cannot access class 'com.result.Owner.Nested.VeryNested'. Check your module classpath for missing or conflicting dependencies. /Call.kt:(383,389): error: Unresolved reference 'result'. diff --git a/compiler/testData/diagnostics/tests/javac/Lambda.fir.kt b/compiler/testData/diagnostics/tests/javac/Lambda.fir.kt index 82e82ec4ef5..3ea78c18e27 100644 --- a/compiler/testData/diagnostics/tests/javac/Lambda.fir.kt +++ b/compiler/testData/diagnostics/tests/javac/Lambda.fir.kt @@ -81,9 +81,9 @@ import com.repo.request_withNested class Model { fun call() { - request_a().mapError { 1 + 1 } - request_a().mapError { it -> 1 + 1 } - request_withNested().mapError { 1 + 1 } + request_a().mapError { 1 + 1 } + request_a().mapError { it -> 1 + 1 } + request_withNested().mapError { 1 + 1 } } } diff --git a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.diag.txt b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.diag.txt new file mode 100644 index 00000000000..b3f37231655 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.diag.txt @@ -0,0 +1,5 @@ +// -- Module: -- + +// -- Module: -- + +// -- Module:
-- diff --git a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.diag.txt b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.diag.txt new file mode 100644 index 00000000000..b6c1215c3f1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.diag.txt @@ -0,0 +1,3 @@ +/module_main_BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt:(84,112): error: Cannot access class 'InaccessibleType'. Check your module classpath for missing or conflicting dependencies. + +/module_main_BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt:(84,114): error: Argument type mismatch: actual type is 'Box (parameters.size = 0, arguments.size = 1))>', but 'Box>' was expected. diff --git a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt index ace43aef755..48e33e07475 100644 --- a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt +++ b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.fir.kt @@ -1,3 +1,4 @@ +// RENDER_DIAGNOSTICS_FULL_TEXT // MODULE: missing class InaccessibleType @@ -12,5 +13,5 @@ fun consumeBoxedInaccessibleType(arg: Box>) {} // MODULE: main(library) fun test() { - consumeBoxedInaccessibleType(>; Box (parameters.size = 0, arguments.size = 1))>")!>produceBoxedInaccessibleType()) + consumeBoxedInaccessibleType(produceBoxedInaccessibleType()) } diff --git a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.kt b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.kt index 8cd9ac5e5a3..ccb75ae63a1 100644 --- a/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.kt +++ b/compiler/testData/diagnostics/tests/multimodule/BoxedInaccessibleGenericTypeUsedByDependencies.kt @@ -1,3 +1,4 @@ +// RENDER_DIAGNOSTICS_FULL_TEXT // MODULE: missing class InaccessibleType