[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
|
package org.jetbrains.kotlin.fir.backend.generators
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.fir.backend.*
|
import org.jetbrains.kotlin.fir.backend.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||||
@@ -73,9 +74,20 @@ internal class ClassMemberGenerator(
|
|||||||
processedCallableNames += DataClassMembersGenerator(components).generateDataClassMembers(klass, irClass)
|
processedCallableNames += DataClassMembersGenerator(components).generateDataClassMembers(klass, irClass)
|
||||||
}
|
}
|
||||||
with(fakeOverrideGenerator) { irClass.addFakeOverrides(klass, processedCallableNames) }
|
with(fakeOverrideGenerator) { irClass.addFakeOverrides(klass, processedCallableNames) }
|
||||||
klass.declarations.forEach {
|
klass.declarations.forEach { declaration ->
|
||||||
if (it !is FirTypeAlias && (it !is FirConstructor || !it.isPrimary)) {
|
when {
|
||||||
it.accept(visitor, null)
|
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)
|
annotationGenerator.generate(irClass, klass)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
val o = object {
|
val o = object {
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val fn: () -> String)
|
open class Base(val fn: () -> String)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val fn: () -> String)
|
open class Base(val fn: () -> String)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val fn: () -> String)
|
open class Base(val fn: () -> String)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class Base(val fn: () -> String)
|
open class Base(val fn: () -> String)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val o = object {
|
val o = object {
|
||||||
inner class A(val value: String = "OK")
|
inner class A(val value: String = "OK")
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
class Local {
|
class Local {
|
||||||
open inner class Inner(val s: String) {
|
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
|
// Enable for JVM backend when KT-8120 gets fixed
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// Enable for JVM backend when KT-8120 gets fixed
|
// Enable for JVM backend when KT-8120 gets fixed
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
val a = 1
|
val a = 1
|
||||||
fun calc () : Int {
|
fun calc () : Int {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun String.bar(): String {
|
fun String.bar(): String {
|
||||||
open class Local {
|
open class Local {
|
||||||
fun result() = this@bar
|
fun result() = this@bar
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var log = ""
|
var log = ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user