[FIR] Implement checker for missing dependency supertypes

#KT-60778 Fixed
This commit is contained in:
Brian Norman
2023-09-11 09:44:55 -05:00
committed by Space Team
parent a72eafc92b
commit 365ce2a6a5
33 changed files with 403 additions and 76 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ compiler/testData/cli/jvm/firDeprecationJava.kt:3:12: warning: '@Deprecated(...)
compiler/testData/cli/jvm/firDeprecationJava.kt:4:17: warning: '@Deprecated(...) fun bar(a: String!, b: Int, c: Double): String!' is deprecated. Deprecated in Java.
JavaClass().bar("", 1, 2.0)
^
compiler/testData/cli/jvm/firDeprecationJava.kt:5:27: warning: '@Deprecated(...) field baz: List!' is deprecated. Deprecated in Java.
compiler/testData/cli/jvm/firDeprecationJava.kt:5:27: warning: '@Deprecated(...) field baz: ft<MutableList<String!>, List<String!>?>' is deprecated. Deprecated in Java.
val baz = JavaClass().baz
^
OK
@@ -1,3 +1,5 @@
import java.util.List;
public class JavaClass {
@Deprecated
public String bar(String a, int b, double c) {
+1 -1
View File
@@ -1,4 +1,4 @@
compiler/testData/cli/jvm/singleJavaFileRoots/test.kt:7:9: error: cannot access class 'C!'. Check your module classpath for missing or conflicting dependencies.
compiler/testData/cli/jvm/singleJavaFileRoots/test.kt:7:9: error: cannot access class 'C'. Check your module classpath for missing or conflicting dependencies.
B().c()
^
compiler/testData/cli/jvm/singleJavaFileRoots/test.kt:8:5: error: unresolved reference 'C'.
@@ -1,7 +1,5 @@
// IGNORE_BACKEND_K1: ANY
// IGNORE_REASON: new rules for supertypes matching are implemented only in K2
// IGNORE_BACKEND_K2: JS_IR, JS_IR_ES6
// IGNORE_REASON: `JsName` in js.translator/testData/_commonFiles/testUtils.kt is invisible for some reason
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-59356
@@ -16,7 +14,7 @@ fun commonBox(): String {
return C().foo()
}
// MODULE: platform-jvm()()(common)
// MODULE: platform()()(common)
// FILE: main.kt
open class B : A() {
override fun foo(): String = "OK"
@@ -1,7 +1,5 @@
// IGNORE_BACKEND_K1: ANY
// IGNORE_REASON: KT-59355 is fixed only in K2
// IGNORE_BACKEND_K2: JS_IR, JS_IR_ES6
// IGNORE_REASON: `JsName` in js.translator/testData/_commonFiles/testUtils.kt is invisible for some reason
// LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-59355
@@ -29,7 +27,7 @@ fun commonBox(): String {
return x + y
}
// MODULE: platform-jvm()()(common)
// MODULE: platform()()(common)
// FILE: main.kt
public actual open class Some actual constructor() {
public actual class ProtectedNested actual constructor() {
@@ -1,7 +1,7 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND_K1: JS_IR
// IGNORE_BACKEND_K1: JS_IR_ES6
// IGNORE_BACKEND_K1: WASM
// MODULE: lib-common
@@ -11,7 +11,7 @@ package test
expect enum class E
// MODULE: lib-jvm()()(lib-common)
// MODULE: lib()()(lib-common)
// FILE: jvm.kt
package test
@@ -22,7 +22,7 @@ enum class F {
OK;
}
// MODULE: main(lib-jvm)
// MODULE: main(lib)
// FILE: jvm2.kt
import test.E.*
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/computeSupertypeWithMissingDependency/source.kt:7:11: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
b.foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/computeSupertypeWithMissingDependency/source.kt:9:11: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
b.bar()
^
COMPILATION_ERROR
@@ -0,0 +1,34 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:3:1: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
class SubSub : Sub()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:4:14: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
class Client<T : Sub>(val prop: T)
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:5:6: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
fun <T : Sub> withTypeParam() {}
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:12:11: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
Sub().unresolved()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:12:11: error: unresolved reference 'unresolved'.
Sub().unresolved()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:13:14: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
SubSub().unresolved()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:13:14: error: unresolved reference 'unresolved'.
SubSub().unresolved()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:14:15: error: cannot access 'test.Super' which is a supertype of '<anonymous>'. Check your module classpath for missing or conflicting dependencies.
val obj = object : Sub() {}
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:15:25: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
withCallRefArg(Sub::resolved)
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:16:11: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
Sub().resolved()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyErrorPositions/source.kt:17:11: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
Sub().extension()
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInJava/source.kt:3:1: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
class SubSub : Sub()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInJava/source.kt:5:22: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
fun bar() = SubSub().foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInJava/source.kt:5:22: error: unresolved reference 'foo'.
fun bar() = SubSub().foo()
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInKotlin/source.kt:3:1: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
class SubSub : Sub()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInKotlin/source.kt:5:22: error: cannot access 'test.Super' which is a supertype of 'SubSub'. Check your module classpath for missing or conflicting dependencies.
fun bar() = SubSub().foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyInKotlin/source.kt:5:22: error: unresolved reference 'foo'.
fun bar() = SubSub().foo()
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyMissingInterface/source.kt:5:15: error: cannot access 'test.A' which is a supertype of 'test.B'. Check your module classpath for missing or conflicting dependencies.
D.m(B.n())
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyOfEnclosingClass/source.kt:6:16: error: cannot access 'test.Super' which is a supertype of 'test.SubClass'. Check your module classpath for missing or conflicting dependencies.
SubClass().Inner() // Error - dispatch receiver misses supertype
^
COMPILATION_ERROR
@@ -0,0 +1,16 @@
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:12:32: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
fun simpleFun(arg: Sub): Sub = Sub()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:19:18: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
val x: Sub = Sub()
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:21:18: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
useCallRef(::Sub)
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:22:15: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
simpleFun(Sub())
^
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:23:20: error: cannot access 'test.Super' which is a supertype of 'test.Sub'. Check your module classpath for missing or conflicting dependencies.
inlineFun<Sub>(Sub())
^
COMPILATION_ERROR
@@ -0,0 +1,25 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:7:8: error: cannot access class 'a.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:7:20: error: cannot access class 'a.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:8:8: error: cannot access class 'a.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceAGeneric("foo"))
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:8:20: error: cannot access class 'a.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceAGeneric("foo"))
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:12:8: error: cannot access class 'a.AA.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeAA(b1.produceAA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:12:21: error: cannot access class 'a.AA.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeAA(b1.produceAA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:16:8: error: cannot access class 'a.AAA.Inner.InnerInner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeAAA(b1.produceAAA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyConflictingLibraries/source.kt:16:22: error: cannot access class 'a.AAA.Inner.InnerInner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeAAA(b1.produceAAA())
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyDifferentCases/source.kt:6:7: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
b.returnType()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyDifferentCases/source.kt:7:7: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
b.parameter(null)
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyDifferentCases/source.kt:8:10: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
null.extensionReceiver()
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyJava/source.kt:4:17: error: cannot access class 'test.Bar'. Check your module classpath for missing or conflicting dependencies.
val bar = f.getBar()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyJava/source.kt:5:5: error: cannot access class 'test.Bar'. Check your module classpath for missing or conflicting dependencies.
bar.bar()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyJava/source.kt:5:9: error: unresolved reference 'bar'.
bar.bar()
^
COMPILATION_ERROR
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyJavaConflictingLibraries/source.kt:4:8: error: cannot access class 'test.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceA())
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencyJavaConflictingLibraries/source.kt:4:20: error: cannot access class 'test.A.Inner'. Check your module classpath for missing or conflicting dependencies.
b2.consumeA(b1.produceA())
^
COMPILATION_ERROR
@@ -0,0 +1,13 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencySimple/source.kt:7:7: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
b.foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencySimple/source.kt:10:21: error: initializer type mismatch: expected 'kotlin.String', actual 'a.A'.
val x: String = b.foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencySimple/source.kt:10:21: error: type mismatch: inferred type is 'a.A', but 'kotlin.String' was expected.
val x: String = b.foo()
^
compiler/testData/compileKotlinAgainstCustomBinaries/missingDependencySimple/source.kt:10:23: error: cannot access class 'a.A'. Check your module classpath for missing or conflicting dependencies.
val x: String = b.foo()
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
compiler/testData/compileKotlinAgainstCustomBinaries/missingStaticClass/source.kt:4:15: error: cannot access class 'test.C.D'. Check your module classpath for missing or conflicting dependencies.
val c = C.makeD()
^
COMPILATION_ERROR