[FE] Allow to infer generic property type from a context receiver type
This commit is contained in:
committed by
TeamCityServer
parent
dcb3fc5508
commit
837f3b98fa
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
class Result<T>(val x: T)
|
||||
|
||||
context(Result<T>)
|
||||
val <T> result: Result<T> get() = this@Result
|
||||
|
||||
fun <T> Result<T>.x(): T {
|
||||
with(result) {
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
with(Result<String>("OK")) {
|
||||
return x()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user