[K/N][tests] Added a test for anonymous object in a top level inline fun

This commit is contained in:
Igor Chevdar
2023-09-04 17:37:47 +03:00
parent b66a6fcc08
commit 9d2d75313b
@@ -211,6 +211,14 @@ private fun checkLocalClasses(args: Array<String>) {
::suspendFunWithLocalClass.runCoroutine() ::suspendFunWithLocalClass.runCoroutine()
} }
interface HasFoo {
fun foo(): String
}
private inline fun getHasFoo(s: String) = object : HasFoo {
override fun foo(): String = s
}
private fun checkAnonymousObjects(args: Array<String>) { private fun checkAnonymousObjects(args: Array<String>) {
// Anonymous object. // Anonymous object.
with(object : Any() { with(object : Any() {
@@ -370,6 +378,16 @@ private fun checkAnonymousObjects(args: Array<String>) {
} }
} }
::suspendFunWithAnonymousObject.runCoroutine() ::suspendFunWithAnonymousObject.runCoroutine()
val hasFoo = getHasFoo("zzz")
checkClass(
hasFoo::class,
expectedQualifiedName = null,
expectedSimpleName = null,
expectedToStringName = "class codegen.kclass.kclass0.Kclass0Kt$1",
expectedInstance = hasFoo,
expectedNotInstance = Any()
)
} }
private fun checkAnonymousObjectsAssignedToProperty(args: Array<String>) { private fun checkAnonymousObjectsAssignedToProperty(args: Array<String>) {