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:
+12
@@ -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
|
||||
}
|
||||
Vendored
+8
@@ -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
|
||||
Vendored
+9
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user