JVM IR: fix HashCode intrinsic for generics substituted with primitives
The problem here was that although the IR type of the expression was primitive, the type of the actual expression in the bytecode generated after type erasure was `Ljava/lang/Object;`, and we were trying to call a non-existing method `Object.hashCode(Object)`. #KT-41669 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
class A<T> {
|
||||
fun id(x: T): T = x
|
||||
}
|
||||
|
||||
fun foo(f: A<Boolean>): Int =
|
||||
f.id(true).hashCode()
|
||||
|
||||
fun box(): String =
|
||||
if (foo(A<Boolean>()) == true.hashCode()) "OK" else "Fail"
|
||||
Reference in New Issue
Block a user