[FIR] Replace local types with Any in deserializer
This commit is contained in:
+5
-2
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.firUnsafe
|
|||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
|
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||||
@@ -89,9 +90,11 @@ class FirTypeDeserializer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun computeClassifier(fqNameIndex: Int): ConeClassLikeLookupTag? {
|
private fun computeClassifier(fqNameIndex: Int): ConeClassLikeLookupTag {
|
||||||
try {
|
try {
|
||||||
val id = nameResolver.getClassId(fqNameIndex)
|
// We can't just load local types as is, because later we will get an exception
|
||||||
|
// while trying to get corresponding FIR class
|
||||||
|
val id = nameResolver.getClassId(fqNameIndex).takeIf { !it.isLocal } ?: StandardClassIds.Any
|
||||||
return ConeClassLikeLookupTagImpl(id)
|
return ConeClassLikeLookupTagImpl(id)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
throw RuntimeException("Looking up for ${nameResolver.getClassId(fqNameIndex)}", e)
|
throw RuntimeException("Looking up for ${nameResolver.getClassId(fqNameIndex)}", e)
|
||||||
|
|||||||
+5
@@ -405,6 +405,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnonymousObjectInProperty.kt")
|
||||||
|
public void testAnonymousObjectInProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryProperty.kt")
|
@TestMetadata("LibraryProperty.kt")
|
||||||
public void testLibraryProperty() throws Exception {
|
public void testLibraryProperty() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// FILE: A.kt
|
||||||
|
|
||||||
|
abstract class A {
|
||||||
|
private val x = object {
|
||||||
|
fun foo() = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
protected val y = x.foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: B.kt
|
||||||
|
|
||||||
|
class B : A() {
|
||||||
|
val z = y
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = B().z
|
||||||
+5
@@ -410,6 +410,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnonymousObjectInProperty.kt")
|
||||||
|
public void testAnonymousObjectInProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryProperty.kt")
|
@TestMetadata("LibraryProperty.kt")
|
||||||
public void testLibraryProperty() throws Exception {
|
public void testLibraryProperty() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||||
|
|||||||
Generated
+5
@@ -405,6 +405,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnonymousObjectInProperty.kt")
|
||||||
|
public void testAnonymousObjectInProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryProperty.kt")
|
@TestMetadata("LibraryProperty.kt")
|
||||||
public void testLibraryProperty() throws Exception {
|
public void testLibraryProperty() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||||
|
|||||||
+5
@@ -405,6 +405,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnonymousObjectInProperty.kt")
|
||||||
|
public void testAnonymousObjectInProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryProperty.kt")
|
@TestMetadata("LibraryProperty.kt")
|
||||||
public void testLibraryProperty() throws Exception {
|
public void testLibraryProperty() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||||
|
|||||||
+5
@@ -405,6 +405,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnonymousObjectInProperty.kt")
|
||||||
|
public void testAnonymousObjectInProperty() throws Exception {
|
||||||
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("LibraryProperty.kt")
|
@TestMetadata("LibraryProperty.kt")
|
||||||
public void testLibraryProperty() throws Exception {
|
public void testLibraryProperty() throws Exception {
|
||||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user