FIR2IR: don't apply SAM conversion for type parameter based types

#KT-58893 Fixed
#KT-58884 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-08-21 19:19:17 +02:00
committed by Space Team
parent a832510487
commit 289dafa331
10 changed files with 94 additions and 4 deletions
+47
View File
@@ -0,0 +1,47 @@
// ISSUE: KT-58893
// TARGET_BACKEND: JVM
// WITH_STDLIB
// IGNORE_INLINER: IR
// FILE: InOrder.java
public class InOrder {
<T> T verify(T mock) {
String s = mock.getClass().toString();
if (!s.equals(TestKt.expected)) throw new IllegalStateException(s);
return mock;
}
}
// FILE: test.kt
inline fun <reified T : Any> mock(s: String = ""): T = MOCK as T
val MOCK = {}
inline fun inOrder(
vararg mocks: Any,
evaluation: InOrder.() -> Unit
) {
inOrder.evaluation()
InOrder().evaluation()
}
val inOrder = object : InOrder() {
override fun <T : Any?> verify(mock: T): T {
val s = mock!!.javaClass.toString()
if (s != expected) throw IllegalStateException(s)
return mock
}
}
lateinit var expected: String
fun box(): String {
val mock = mock<() -> Unit>()
expected = mock.javaClass.toString()
inOrder(mock) {
verify(mock)()
}
return "OK"
}