Add new metadata flag for class files compiled with FIR

Report a separate error when class files compiled with FIR are in
dependencies, in addition to the one for class files compiled with FE
1.0 + JVM IR.

 #KT-43592
This commit is contained in:
Alexander Udalov
2020-12-07 21:26:23 +01:00
parent cbd90c3af5
commit 3f517d7e8d
16 changed files with 74 additions and 37 deletions
@@ -119,6 +119,7 @@ public interface Errors {
DiagnosticFactory1<PsiElement, String> MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, String> PRE_RELEASE_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, String> IR_COMPILED_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, String> FIR_COMPILED_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory2<PsiElement, String, IncompatibleVersionErrorData<?>> INCOMPATIBLE_CLASS = DiagnosticFactory2.create(ERROR);
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
@@ -402,6 +402,7 @@ public class DefaultErrorMessages {
MAP.put(MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS, "Cannot access script provided property class ''{0}''. Check your module classpath for missing or conflicting dependencies", TO_STRING);
MAP.put(PRE_RELEASE_CLASS, "{0} is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler", TO_STRING);
MAP.put(IR_COMPILED_CLASS, "{0} is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler", TO_STRING);
MAP.put(FIR_COMPILED_CLASS, "{0} is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler", TO_STRING);
MAP.put(INCOMPATIBLE_CLASS,
"{0} was compiled with an incompatible version of Kotlin. {1}",
TO_STRING,
@@ -59,6 +59,9 @@ object MissingDependencyClassChecker : CallChecker {
if (source.isPreReleaseInvisible) {
return PRE_RELEASE_CLASS.on(reportOn, source.presentableString)
}
if (source.abiStability == DeserializedContainerAbiStability.FIR_UNSTABLE) {
return FIR_COMPILED_CLASS.on(reportOn, source.presentableString)
}
if (source.abiStability == DeserializedContainerAbiStability.IR_UNSTABLE) {
return IR_COMPILED_CLASS.on(reportOn, source.presentableString)
}