[FE] Allow to infer generic property type from a context receiver type

This commit is contained in:
Anastasiya Shadrina
2021-02-17 19:42:21 +07:00
committed by TeamCityServer
parent dcb3fc5508
commit 837f3b98fa
4 changed files with 34 additions and 0 deletions
@@ -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()
}
}