[FIR2IR] Fix problem with double-generation of local class members
This commit is contained in:
+15
-3
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.backend.generators
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.backend.*
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||
@@ -73,9 +74,20 @@ internal class ClassMemberGenerator(
|
||||
processedCallableNames += DataClassMembersGenerator(components).generateDataClassMembers(klass, irClass)
|
||||
}
|
||||
with(fakeOverrideGenerator) { irClass.addFakeOverrides(klass, processedCallableNames) }
|
||||
klass.declarations.forEach {
|
||||
if (it !is FirTypeAlias && (it !is FirConstructor || !it.isPrimary)) {
|
||||
it.accept(visitor, null)
|
||||
klass.declarations.forEach { declaration ->
|
||||
when {
|
||||
declaration is FirTypeAlias -> {
|
||||
}
|
||||
declaration is FirConstructor && declaration.isPrimary -> {
|
||||
}
|
||||
declaration is FirRegularClass && declaration.visibility == Visibilities.LOCAL -> {
|
||||
val irNestedClass = classifierStorage.getCachedIrClass(declaration)!!
|
||||
irNestedClass.parent = irClass
|
||||
conversionScope.withParent(irNestedClass) {
|
||||
convertClassContent(irNestedClass, declaration)
|
||||
}
|
||||
}
|
||||
else -> declaration.accept(visitor, null)
|
||||
}
|
||||
}
|
||||
annotationGenerator.generate(irClass, klass)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box() : String {
|
||||
val o = object {
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
open class Base(val fn: () -> String)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
open class Base(val fn: () -> String)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
open class Base(val fn: () -> String)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
open class Base(val fn: () -> String)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
val o = object {
|
||||
inner class A(val value: String = "OK")
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
class Local {
|
||||
open inner class Inner(val s: String) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// Enable for JVM backend when KT-8120 gets fixed
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// Enable for JVM backend when KT-8120 gets fixed
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A {
|
||||
val a = 1
|
||||
fun calc () : Int {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun String.bar(): String {
|
||||
open class Local {
|
||||
fun result() = this@bar
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun box(): String {
|
||||
var log = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user