[FIR2IR] Use only data class primary constructor parameters for equals
This commit is contained in:
committed by
Mikhail Glukhikh
parent
0890b8bad3
commit
ef8bcceb8e
+5
-1
@@ -119,7 +119,11 @@ class DataClassMembersGenerator(val components: Fir2IrComponents) {
|
|||||||
(this.name == toStringName && matchesToStringSignature)
|
(this.name == toStringName && matchesToStringSignature)
|
||||||
|
|
||||||
fun generate(klass: FirClass<*>): List<Name> {
|
fun generate(klass: FirClass<*>): List<Name> {
|
||||||
val properties = irClass.declarations.filterIsInstance<IrProperty>().map { it.descriptor }
|
val propertyParametersCount = irClass.primaryConstructor?.explicitParameters?.size ?: 0
|
||||||
|
val properties = irClass.declarations
|
||||||
|
.filterIsInstance<IrProperty>()
|
||||||
|
.take(propertyParametersCount)
|
||||||
|
.map { it.descriptor }
|
||||||
if (properties.isEmpty()) {
|
if (properties.isEmpty()) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
internal data class A1(val prop1: String) {
|
internal data class A1(val prop1: String) {
|
||||||
val prop2: String = "const2"
|
val prop2: String = "const2"
|
||||||
var prop3: String = ""
|
var prop3: String = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user