Add frontend checks for missing dependency supertypes

Call checker and declaration checker are used in order to preserve backward compatibility.
Attempt to use classifier usage checker was not good enouth,
since not all errors found with it would actually be reported before.
For example types and constructor calls don't cause supertypes to resolve,
so missing supertypes would not lead to errors in case they are the only use of class name.

Updated tests failing due to missing Java dependencies in superclasses.
This commit is contained in:
Pavel Kirpichenkov
2019-11-05 12:03:53 +03:00
parent 388cd53105
commit 8c52bb4212
49 changed files with 423 additions and 1373 deletions
@@ -0,0 +1,12 @@
package test
public open class Super
public class SubClass : Super() {
inner class Inner
class InnerStatic
}
public object SubObject : Super() {
class InnerStatic
}
@@ -0,0 +1,8 @@
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class test.SubClass, unresolved supertypes: test.Super
class test.SubObject, unresolved supertypes: test.Super
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,9 @@
import test.*
import test.SubClass.InnerStatic as ClassInnerStatic // No error - does not force supertype resolution for SubClass
import test.SubObject.InnerStatic // TODO report error - imports from object force resolution of its supertypes
fun test() {
SubClass().Inner() // Error - dispatch receiver misses supertype
SubClass.InnerStatic() // No error - does not force supertype resolution for SubClass
SubObject.InnerStatic() // TODO report error - for objects supertypes are resolved here
}