Fix ABI version diagnostic for old package facades
Restore the test data that was erroneously replaced in 84649e4
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
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/Wrong_packageKt.class: error: class 'wrong/Wrong_packageKt' 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()
|
||||
^
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||
import org.jetbrains.kotlin.load.java.lazy.resolveKotlinBinaryClass
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaPackage
|
||||
import org.jetbrains.kotlin.load.kotlin.DeserializedDescriptorResolver
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
@@ -76,8 +77,16 @@ public class LazyJavaPackageScope(
|
||||
partToFacade()[partName]
|
||||
|
||||
private val deserializedPackageScope = c.storageManager.createLazyValue {
|
||||
if (kotlinBinaryClasses().isEmpty())
|
||||
if (kotlinBinaryClasses().isEmpty()) {
|
||||
// If the scope is queried but no package parts are found, there's a possibility that we're trying to load symbols
|
||||
// from an old package with the binary-incompatible facade.
|
||||
// We try to read the old package facade if there is one, to report the "incompatible ABI version" message.
|
||||
packageFragment.oldPackageFacade?.let { binaryClass ->
|
||||
c.components.deserializedDescriptorResolver.readData(binaryClass, DeserializedDescriptorResolver.KOTLIN_PACKAGE_FACADE)
|
||||
}
|
||||
|
||||
JetScope.Empty
|
||||
}
|
||||
else {
|
||||
c.components.deserializedDescriptorResolver.createKotlinPackageScope(packageFragment, kotlinBinaryClasses())
|
||||
}
|
||||
|
||||
+5
-6
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin;
|
||||
|
||||
import kotlin.KotlinPackage;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -37,16 +36,16 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil;
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.Kind.CLASS;
|
||||
import static org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.Kind.MULTIFILE_CLASS_PART;
|
||||
import static kotlin.KotlinPackage.setOf;
|
||||
import static org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.Kind.*;
|
||||
|
||||
public final class DeserializedDescriptorResolver {
|
||||
private final ErrorReporter errorReporter;
|
||||
private DeserializationComponents components;
|
||||
|
||||
public static final Set<KotlinClassHeader.Kind> KOTLIN_CLASS = KotlinPackage.setOf(CLASS);
|
||||
public static final Set<KotlinClassHeader.Kind> KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART =
|
||||
KotlinPackage.setOf(KotlinClassHeader.Kind.FILE_FACADE, MULTIFILE_CLASS_PART);
|
||||
public static final Set<KotlinClassHeader.Kind> KOTLIN_CLASS = setOf(CLASS);
|
||||
public static final Set<KotlinClassHeader.Kind> KOTLIN_FILE_FACADE_OR_MULTIFILE_CLASS_PART = setOf(FILE_FACADE, MULTIFILE_CLASS_PART);
|
||||
public static final Set<KotlinClassHeader.Kind> KOTLIN_PACKAGE_FACADE = setOf(PACKAGE_FACADE);
|
||||
|
||||
public DeserializedDescriptorResolver(@NotNull ErrorReporter errorReporter) {
|
||||
this.errorReporter = errorReporter;
|
||||
|
||||
Reference in New Issue
Block a user