c628172235
When using a field as the delegate for a super-interface of an object, make sure uninitialized fields are not allowed. Specifically, disallow access to these fields when referenced via object qualifier. ^KT-56489 Fixed
33 lines
788 B
Kotlin
Vendored
33 lines
788 B
Kotlin
Vendored
// WITH_STDLIB
|
|
// NI_EXPECTED_FILE
|
|
// ISSUE: KT-15566, KT-56489
|
|
|
|
import DefaultHttpClient.client
|
|
|
|
interface HttpClient
|
|
|
|
class HttpClientImpl : HttpClient
|
|
|
|
// Below we should have initialization error for both (!) delegates
|
|
|
|
object DefaultHttpClient : HttpClient by <!UNINITIALIZED_VARIABLE!>client<!> {
|
|
val client = HttpClientImpl()
|
|
}
|
|
|
|
object DefaultHttpClientWithGetter : HttpClient by client {
|
|
val client get() = HttpClientImpl()
|
|
}
|
|
|
|
object DefaultHttpClientWithFun : HttpClient by fClient() {
|
|
}
|
|
|
|
private fun fClient() = HttpClientImpl()
|
|
|
|
object DefaultHttpClientWithBy : HttpClient by client {
|
|
val client by lazy { HttpClientImpl() }
|
|
}
|
|
|
|
object DefaultFqHttpClient : HttpClient by DefaultFqHttpClient.<!UNINITIALIZED_VARIABLE!>client<!> {
|
|
val client = HttpClientImpl()
|
|
}
|