Fir2IrLazyClass: don't generate non-f/o properties from superclass
This commit is contained in:
committed by
TeamCityServer
parent
9b0ada2b0f
commit
94014ba3eb
@@ -23,6 +23,8 @@ import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.ir.util.isFakeOverride
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class Fir2IrLazyClass(
|
||||
@@ -151,7 +153,7 @@ class Fir2IrLazyClass(
|
||||
if (declaration.name !in processedNames) {
|
||||
processedNames += declaration.name
|
||||
scope.processPropertiesByName(declaration.name) {
|
||||
if (it is FirPropertySymbol) {
|
||||
if (it is FirPropertySymbol && it.dispatchReceiverClassOrNull() == fir.symbol.toLookupTag()) {
|
||||
result += declarationStorage.getIrPropertySymbol(it).owner as IrProperty
|
||||
}
|
||||
}
|
||||
@@ -172,7 +174,9 @@ class Fir2IrLazyClass(
|
||||
// TODO: remove this check to save time
|
||||
for (declaration in result) {
|
||||
if (declaration.parent != this) {
|
||||
throw AssertionError("Unmatched parent for lazy class member")
|
||||
throw AssertionError(
|
||||
"Unmatched parent for lazy class ${fir.name} member ${declaration.render()} f/o ${declaration.isFakeOverride}"
|
||||
)
|
||||
}
|
||||
}
|
||||
result
|
||||
|
||||
+5
@@ -435,6 +435,11 @@ public class FirCompileKotlinAgainstKotlinTestGenerated extends AbstractFirCompi
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IncrementalCompilerRunner.kt")
|
||||
public void testIncrementalCompilerRunner() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrConstAcceptMultiModule.kt")
|
||||
public void testIrConstAcceptMultiModule() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt");
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: A.kt
|
||||
// WITH_RUNTIME
|
||||
|
||||
abstract class IncrementalCompilerRunner<T>(
|
||||
private val workingDir: String,
|
||||
val fail: Boolean,
|
||||
val output: Collection<String> = emptyList()
|
||||
) {
|
||||
fun res(res: T? = null): String = (res as? String) ?: (if (fail) "FAIL" else workingDir)
|
||||
}
|
||||
|
||||
class IncrementalJsCompilerRunner(
|
||||
private val workingDir: String,
|
||||
fail: Boolean = true
|
||||
) : IncrementalCompilerRunner<String>(workingDir, fail) {
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun box(): String {
|
||||
val runner = IncrementalJsCompilerRunner(workingDir = "OK", fail = false)
|
||||
return runner.res()
|
||||
}
|
||||
Generated
+5
@@ -440,6 +440,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IncrementalCompilerRunner.kt")
|
||||
public void testIncrementalCompilerRunner() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrConstAcceptMultiModule.kt")
|
||||
public void testIrConstAcceptMultiModule() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt");
|
||||
|
||||
Generated
+5
@@ -435,6 +435,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IncrementalCompilerRunner.kt")
|
||||
public void testIncrementalCompilerRunner() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrConstAcceptMultiModule.kt")
|
||||
public void testIrConstAcceptMultiModule() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt");
|
||||
|
||||
+5
@@ -435,6 +435,11 @@ public class JvmIrAgainstOldBoxTestGenerated extends AbstractJvmIrAgainstOldBoxT
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IncrementalCompilerRunner.kt")
|
||||
public void testIncrementalCompilerRunner() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrConstAcceptMultiModule.kt")
|
||||
public void testIrConstAcceptMultiModule() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt");
|
||||
|
||||
+5
@@ -435,6 +435,11 @@ public class JvmOldAgainstIrBoxTestGenerated extends AbstractJvmOldAgainstIrBoxT
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/ExistingSymbolInFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IncrementalCompilerRunner.kt")
|
||||
public void testIncrementalCompilerRunner() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IncrementalCompilerRunner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("IrConstAcceptMultiModule.kt")
|
||||
public void testIrConstAcceptMultiModule() throws Exception {
|
||||
runTest("compiler/testData/compileKotlinAgainstKotlin/fir/IrConstAcceptMultiModule.kt");
|
||||
|
||||
Reference in New Issue
Block a user