FIR resolve: add partial support of extension lambda calls

Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
This commit is contained in:
Mikhail Glukhikh
2019-12-23 15:56:50 +03:00
parent 49e94f1ee3
commit de50f8aef3
65 changed files with 292 additions and 144 deletions
@@ -10,5 +10,5 @@ return if (answer == 2) "OK" else "FAIL"
}
fun apply(arg:String, f : String.() -> Int) : Int {
return arg.<!UNRESOLVED_REFERENCE!>f<!>()
return arg.f()
}
@@ -2,15 +2,15 @@
class A {
fun foo() {}
fun bar(f: A.() -> Unit = {}) = <!INAPPLICABLE_CANDIDATE!>f<!>()
fun bar(f: A.() -> Unit = {}) = f()
}
class B {
class D {
init {
A().bar {
this.<!UNRESOLVED_REFERENCE!>foo<!>()
<!UNRESOLVED_REFERENCE!>foo<!>()
this.foo()
foo()
}
}
}
@@ -21,7 +21,7 @@ fun <T> generic_invoker(gen : (String) -> T) : T {
}
infix fun <T> T.with(f : T.() -> Unit) {
<!INAPPLICABLE_CANDIDATE!>f<!>()
f()
}
fun main() {
@@ -14,7 +14,7 @@ interface ChannelPipelineFactory{
class StandardPipelineFactory(val config: ChannelPipeline.()->Unit) : ChannelPipelineFactory {
override fun getPipeline() : ChannelPipeline {
val pipeline = DefaultChannelPipeline()
pipeline.<!UNRESOLVED_REFERENCE!>config<!> ()
pipeline.config ()
return pipeline
}
}
@@ -4,5 +4,5 @@ object O
val foo: O.() -> Unit = null!!
fun test() {
O.<!UNRESOLVED_REFERENCE!>foo<!>()
O.foo()
}
@@ -2,6 +2,6 @@ object X
class Y {
fun f(op: X.() -> Unit) {
X.<!UNRESOLVED_REFERENCE!>op<!>()
X.op()
}
}