Improve ABI version error reporting in the compiler

- only report ABI errors if there's at least one other error
- append additional helpful information to the "unresolved reference" error
This commit is contained in:
Alexander Udalov
2015-09-15 19:33:42 +03:00
parent d98b3433eb
commit 2b269b2652
9 changed files with 80 additions and 17 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
import wrong.*
fun foo(x: ClassWithWrongAbiVersion) {
bar()
}
bar()
1.set(2, 3)
}
+9 -3
View File
@@ -1,6 +1,12 @@
compiler/testData/cli/jvm/wrongAbiVersion.kt:4:5: error: unresolved reference: bar
(note: this may be caused by the fact that some classes compiled with an incompatible version of Kotlin were found in the classpath. Such classes cannot be loaded properly by this version of Kotlin compiler. See below for more information)
bar()
^
compiler/testData/cli/jvm/wrongAbiVersion.kt:6:7: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <K, V> kotlin.MutableMap<kotlin.Int, kotlin.Int>.set(key: kotlin.Int, value: kotlin.Int): kotlin.Int? defined in kotlin
(note: this may be caused by the fact that some classes compiled with an incompatible version of Kotlin were found in the classpath. Such classes cannot be loaded properly by this version of Kotlin compiler. See below for more information)
1.set(2, 3)
^
compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: error: class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is unknown, expected ABI version is $ABI_VERSION$
compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: error: class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is unknown, expected ABI version is $ABI_VERSION$
compiler/testData/cli/jvm/wrongAbiVersion.kt:4:3: error: unresolved reference: bar
bar()
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/wrongAbiVersionNoErrors.kt
-classpath
$TESTDATA_DIR$/wrongAbiVersionLib/bin
-d
$TEMP_DIR$
+7
View File
@@ -0,0 +1,7 @@
// This should compile despite the fact that there are usages of symbols with the wrong ABI version!
import wrong.ClassWithInnerLambda
fun happy(): Int {
return 2 + 2
}
+1
View File
@@ -0,0 +1 @@
OK