[FIR] Disallow qualified access to uninitialized fields in delegate

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
This commit is contained in:
Brian Norman
2024-01-18 09:48:10 -06:00
committed by Space Team
parent e2f9af1592
commit c628172235
4 changed files with 15 additions and 21 deletions
@@ -1,5 +1,6 @@
// See KT-15566
// WITH_STDLIB
// NI_EXPECTED_FILE
// ISSUE: KT-15566, KT-56489
import DefaultHttpClient.client
@@ -22,15 +23,10 @@ object DefaultHttpClientWithFun : HttpClient by fClient() {
private fun fClient() = HttpClientImpl()
private fun <T> lazy(init: () -> T): kotlin.<!UNRESOLVED_REFERENCE!>Lazy<!><T> {
init()
null!!
}
object DefaultHttpClientWithBy : HttpClient by client {
val client by lazy { HttpClientImpl() }
}
object DefaultFqHttpClient : HttpClient by DefaultFqHttpClient.<!UNINITIALIZED_VARIABLE!>client<!> {
val client = HttpClientImpl()
}
}