Fix equality comparison of inline classes with primitive underlying type

^KT-54455 Fixed
This commit is contained in:
vladislav.grechko
2022-10-14 17:45:17 +02:00
committed by teamcity
parent 57f1405d95
commit aeccc2e787
10 changed files with 71 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC1(val value: Int)
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC2(val value: Int)
fun foo(x: IC1, y: IC2) = (x as Any) == y
fun box(): String {
if ((IC1(1) as Any) == IC2(1)) return "Fail 1"
if (foo(IC1(1), IC2(1))) return "Fail 2"
return "OK"
}