提交 8ace0d9a 编写于 作者: M Mikhail Glukhikh

[FIR] Replace local types with Any in deserializer

上级 744918fb
......@@ -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.ConeClassifierLookupTag
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.FirClassLikeSymbol
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 {
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)
} catch (e: Throwable) {
throw RuntimeException("Looking up for ${nameResolver.getClassId(fqNameIndex)}", e)
......
......@@ -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);
}
@TestMetadata("AnonymousObjectInProperty.kt")
public void testAnonymousObjectInProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
}
@TestMetadata("LibraryProperty.kt")
public void testLibraryProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
......
// 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
\ No newline at end of file
......@@ -410,6 +410,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
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")
public void testLibraryProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
......
......@@ -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);
}
@TestMetadata("AnonymousObjectInProperty.kt")
public void testAnonymousObjectInProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
}
@TestMetadata("LibraryProperty.kt")
public void testLibraryProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
......
......@@ -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);
}
@TestMetadata("AnonymousObjectInProperty.kt")
public void testAnonymousObjectInProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
}
@TestMetadata("LibraryProperty.kt")
public void testLibraryProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
......
......@@ -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);
}
@TestMetadata("AnonymousObjectInProperty.kt")
public void testAnonymousObjectInProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/AnonymousObjectInProperty.kt");
}
@TestMetadata("LibraryProperty.kt")
public void testLibraryProperty() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/LibraryProperty.kt");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册