[IR] Prevent infinite recursion when rendering bound symbol references

Refactor the renderer, make BoundSymbolReferenceRenderer a static class
to prevent calling RenderIrElementVisitor's methods from it to avoid
infinite recursion in the future.

^KT-52677 Fixed
This commit is contained in:
Sergej Jaskiewicz
2022-11-09 19:05:56 +01:00
committed by Space Team
parent 9fcd185141
commit aa1b18b0c8
20 changed files with 992 additions and 278 deletions
+87
View File
@@ -0,0 +1,87 @@
@Target(allowedTargets = [AnnotationTarget.TYPE])
open annotation class MySerializable : Annotation {
constructor(c: KClass<*>) /* primary */ {
super/*Any*/()
/* <init>() */
}
val c: KClass<*>
field = c
get
}
data class LoginSuccessPacket {
constructor(id: @MySerializable(c = UuidSerializer::class) Uuid1) /* primary */ {
super/*Any*/()
/* <init>() */
}
val id: @MySerializable(c = UuidSerializer::class) Uuid1
field = id
get
operator fun component1(): @MySerializable(c = UuidSerializer::class) Uuid1 {
return <this>.#id
}
fun copy(id: @MySerializable(c = UuidSerializer::class) Uuid1 = <this>.#id): LoginSuccessPacket {
return LoginSuccessPacket(id = id)
}
override fun toString(): String {
return "LoginSuccessPacket(" + "id=" + <this>.#id + ")"
}
override fun hashCode(): Int {
return <this>.#id.hashCode()
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is LoginSuccessPacket -> return false
}
val tmp0_other_with_cast: LoginSuccessPacket = other as LoginSuccessPacket
when {
EQEQ(arg0 = <this>.#id, arg1 = tmp0_other_with_cast.#id).not() -> return false
}
return true
}
}
typealias Uuid = @MySerializable(c = UuidSerializer::class) Uuid1
interface MySerializer<T : Any?> {
}
object UuidSerializer : MySerializer<@MySerializable(c = UuidSerializer::class) Uuid1> {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Uuid1 {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
fun foo(): @MySerializable(c = UuidSerializer::class) Uuid1 {
throw RuntimeException()
}
fun bar(): @MySerializable(c = UuidSerializer::class) Uuid1 {
return foo()
}