Provide additional information about missing supertypes
Add -X flag to report extra compiler diagnostics which migth break compatibility. Use the flag to unconditionally check constructors without fear of prematurely evaluating lazy supertypes. KT-19234 KT-42404 KT-44583
This commit is contained in:
+2
@@ -44,6 +44,8 @@ where advanced options include:
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
||||
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
||||
-Xinference-compatibility Enable compatibility changes for generic type inference algorithm
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
|
||||
+2
@@ -152,6 +152,8 @@ where advanced options include:
|
||||
-Xexplicit-api={strict|warning|disable}
|
||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||
Use 'warning' level to issue warnings instead of errors.
|
||||
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
||||
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
||||
-Xinference-compatibility Enable compatibility changes for generic type inference algorithm
|
||||
-Xinline-classes Enable experimental inline classes
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
|
||||
class test.Sub, unresolved supertypes: test.Super
|
||||
Adding -Xextended-compiler-checks argument might provide additional information.
|
||||
|
||||
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()
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
|
||||
class test.Sub, unresolved supertypes: test.Super
|
||||
Adding -Xextended-compiler-checks argument might provide additional information.
|
||||
|
||||
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()
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
|
||||
class test.Sub, unresolved supertypes: test.Super
|
||||
Adding -Xextended-compiler-checks argument might provide additional information.
|
||||
|
||||
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()
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
|
||||
class test.B, unresolved supertypes: test.A
|
||||
Adding -Xextended-compiler-checks argument might provide additional information.
|
||||
|
||||
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())
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
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
|
||||
Adding -Xextended-compiler-checks argument might provide additional information.
|
||||
|
||||
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
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class Sub extends Super {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class SubKt : Super() {
|
||||
companion object {
|
||||
fun companionMethod() = "OK"
|
||||
}
|
||||
|
||||
object InnerObject {
|
||||
fun objectMethod() = "OK"
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class Super {
|
||||
String foo() {
|
||||
return "Super";
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
|
||||
class test.Sub, unresolved supertypes: test.Super
|
||||
class test.SubKt, unresolved supertypes: test.Super
|
||||
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/incompleteHierarchyWithExtendedCompilerChecks/source.kt:12:32: error: cannot access 'test.Super' which is a supertype of '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 '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 '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 '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 'Sub'. Check your module classpath for missing or conflicting dependencies
|
||||
inlineFun<Sub>(Sub())
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import test.Sub as MySub
|
||||
import test.SubKt
|
||||
|
||||
typealias Sub = MySub
|
||||
|
||||
class Test<T>
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun useCallRef(ref: Any?) {}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun simpleFun(arg: Sub): Sub = Sub()
|
||||
|
||||
inline fun <reified T> inlineFun(t: T) = t
|
||||
|
||||
// In conservative mode without -Xextended-compiler-checks flag these usages don't cause compilation error
|
||||
fun test() {
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val x: Sub = Sub()
|
||||
Test<Sub>()
|
||||
useCallRef(::Sub)
|
||||
simpleFun(Sub())
|
||||
inlineFun<Sub>(Sub())
|
||||
SubKt.companionMethod()
|
||||
SubKt.InnerObject.objectMethod()
|
||||
}
|
||||
Reference in New Issue
Block a user