FIR: don't perform argument check for callable references

This fixes failing FIR2IR test
This commit is contained in:
Mikhail Glukhikh
2019-09-25 15:35:12 +03:00
parent da7d5d5702
commit 4718ae4186
5 changed files with 58 additions and 10 deletions
@@ -48,6 +48,9 @@ fun resolveArgumentExpression(
isSafeCall,
typeProvider
)
// TODO:!
is FirCallableReferenceAccess -> Unit
// NB: FirCallableReferenceAccess should be checked earlier
is FirQualifiedAccessExpression -> resolvePlainExpressionArgument(
csBuilder,
argument,
@@ -60,8 +63,6 @@ fun resolveArgumentExpression(
// TODO:!
is FirAnonymousFunction -> preprocessLambdaArgument(csBuilder, argument, expectedType, expectedTypeRef, acceptLambdaAtoms)
// TODO:!
is FirCallableReferenceAccess -> Unit
// TODO:!
//TODO: Collection literal
is FirWrappedArgumentExpression -> resolveArgumentExpression(
csBuilder,
@@ -0,0 +1,14 @@
class C<T>(var x: T)
var <T> C<T>.y
get() = x
set(v) {
x = v
}
fun use(f: () -> String) {}
fun test1() {
use { C("abc").y }
use(C("abc")::y)
}
@@ -0,0 +1,27 @@
FILE: extensionPropertyInLambda.kt
public final class C<T> : R|kotlin/Any| {
public constructor<T>(x: R|T|): R|C<T>| {
super<R|kotlin/Any|>()
}
public final var x: R|T| = R|<local>/x|
public get(): R|T|
public set(value: R|T|): R|kotlin/Unit|
}
public final var <T> R|C<T>|.y: R|T|
public get(): R|T| {
^ this@R|/C|.R|/C.x|
}
public set(v: R|T|): R|kotlin/Unit| {
this@R|/C|.R|/C.x| = R|<local>/v|
}
public final fun use(f: R|kotlin/Function0<kotlin/String>|): R|kotlin/Unit| {
}
public final fun test1(): R|kotlin/Unit| {
R|/use|(<L> = use@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
R|/C.C|<R|kotlin/String|>(String(abc)).R|/y|
}
)
R|/use|(R|/C.C|<R|kotlin/String|>(String(abc))::R|/y|)
}
@@ -292,6 +292,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
runTest("compiler/fir/resolve/testData/resolve/expresssions/dispatchReceiver.kt");
}
@TestMetadata("extensionPropertyInLambda.kt")
public void testExtensionPropertyInLambda() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/extensionPropertyInLambda.kt");
}
@TestMetadata("genericPropertyAccess.kt")
public void testGenericPropertyAccess() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/genericPropertyAccess.kt");