K2: report MISSING_DEPENDENCY_CLASS in case of error type of expression

This commit is intended to get a more clear diagnostic in case when
the type checker creates an inconsistent error type due to some
classifier inaccessibility. Before this commit, we reported simply
ARGUMENT_TYPE_MISMATCH (see test). Now we report also
MISSING_DEPENDENCY_CLASS by analyzing an error type of a qualified
expression.

#KT-66356 Fixed
This commit is contained in:
Mikhail Glukhikh
2024-03-18 12:19:55 +01:00
committed by Space Team
parent 2d755aabe7
commit 3fbb7bc920
7 changed files with 34 additions and 7 deletions
@@ -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'.
+3 -3
View File
@@ -81,9 +81,9 @@ import com.repo.request_withNested
class Model {
fun call() {
request_a().mapError <!MISSING_DEPENDENCY_CLASS!>{ 1 + 1 }<!>
request_a().mapError { <!MISSING_DEPENDENCY_CLASS!>it<!> -> 1 + 1 }
request_withNested().mapError <!MISSING_DEPENDENCY_CLASS!>{ 1 + 1 }<!>
<!MISSING_DEPENDENCY_CLASS!>request_a<!>().mapError <!MISSING_DEPENDENCY_CLASS!>{ 1 + 1 }<!>
<!MISSING_DEPENDENCY_CLASS!>request_a<!>().mapError { <!MISSING_DEPENDENCY_CLASS!>it<!> -> 1 + 1 }
<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>request_withNested<!>().<!MISSING_DEPENDENCY_CLASS!>mapError<!> <!MISSING_DEPENDENCY_CLASS!>{ 1 + 1 }<!>
}
}