76d3c0e804
This change uncovered the following problem in pipeline: we have a contract,
that all bodies will be generated after all fake overrides will be preprocessed.
But DataClassMembersGenerator generates bodies before f/o creation,
which leads to the problem, if data class has forward reference to some
class which was not processed before (because in this case generator
of `hashCode` function will try to reference f/o, which is not created yet,
which leads to `SymbolAlreadyBound` problem)
```
data class Some(val a: A) {
generated fun hashCode(): Int {
return a.hashCode() // (1) is not generated yet
}
}
class A {
fake-override fun hashCode(): Int // (1)
}
```
This problem will be fixed in the next commit
(related test is compiler/testData/codegen/box/ir/kt52677.kt)
^KT-60924
27 lines
567 B
Kotlin
Vendored
27 lines
567 B
Kotlin
Vendored
// ISSUE: KT-52677
|
|
// IGNORE_BACKEND_K2: ANY
|
|
// MODULE: lib
|
|
// FILE: lib.kt
|
|
|
|
@Target(AnnotationTarget.TYPE)
|
|
annotation class MySerializable(val c: kotlin.reflect.KClass<*>)
|
|
|
|
public data class LoginSuccessPacket(val id: Uuid)
|
|
|
|
public typealias Uuid = @MySerializable(UuidSerializer::class) Uuid1
|
|
|
|
interface MySerializer<T>
|
|
public object UuidSerializer : MySerializer<Uuid>
|
|
public class Uuid1 {
|
|
fun ok() = "OK"
|
|
}
|
|
|
|
// MODULE: main(lib)
|
|
// FILE: main.kt
|
|
|
|
fun foo(): Uuid { throw RuntimeException() }
|
|
|
|
fun bar() = foo()
|
|
|
|
fun box() = LoginSuccessPacket(Uuid()).id.ok()
|