Fix condition of generating equals-impl0 call

This methods should not be called when instances of different inline
classes are being compared

^KT-57242: Fixed
This commit is contained in:
vladislav.grechko
2023-03-10 18:11:42 +01:00
committed by teamcity
parent 948714e7e5
commit 8039e30bbd
5 changed files with 46 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// FULL_JDK
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
import java.util.UUID
import java.util.UUID.randomUUID
OPTIONAL_JVM_INLINE_ANNOTATION
value class IdOne(val id: UUID)
OPTIONAL_JVM_INLINE_ANNOTATION
value class IdTwo(val id: UUID)
fun box(): String {
val sameUUID = randomUUID()
val one = IdOne(sameUUID)
val two = IdTwo(sameUUID)
if (one.equals(two)) return "Fail"
return "OK"
}