FIR: don't perform argument check for callable references
This fixes failing FIR2IR test
This commit is contained in:
@@ -48,6 +48,9 @@ fun resolveArgumentExpression(
|
|||||||
isSafeCall,
|
isSafeCall,
|
||||||
typeProvider
|
typeProvider
|
||||||
)
|
)
|
||||||
|
// TODO:!
|
||||||
|
is FirCallableReferenceAccess -> Unit
|
||||||
|
// NB: FirCallableReferenceAccess should be checked earlier
|
||||||
is FirQualifiedAccessExpression -> resolvePlainExpressionArgument(
|
is FirQualifiedAccessExpression -> resolvePlainExpressionArgument(
|
||||||
csBuilder,
|
csBuilder,
|
||||||
argument,
|
argument,
|
||||||
@@ -60,8 +63,6 @@ fun resolveArgumentExpression(
|
|||||||
// TODO:!
|
// TODO:!
|
||||||
is FirAnonymousFunction -> preprocessLambdaArgument(csBuilder, argument, expectedType, expectedTypeRef, acceptLambdaAtoms)
|
is FirAnonymousFunction -> preprocessLambdaArgument(csBuilder, argument, expectedType, expectedTypeRef, acceptLambdaAtoms)
|
||||||
// TODO:!
|
// TODO:!
|
||||||
is FirCallableReferenceAccess -> Unit
|
|
||||||
// TODO:!
|
|
||||||
//TODO: Collection literal
|
//TODO: Collection literal
|
||||||
is FirWrappedArgumentExpression -> resolveArgumentExpression(
|
is FirWrappedArgumentExpression -> resolveArgumentExpression(
|
||||||
csBuilder,
|
csBuilder,
|
||||||
|
|||||||
+14
@@ -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)
|
||||||
|
}
|
||||||
+27
@@ -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|)
|
||||||
|
}
|
||||||
+5
@@ -292,6 +292,11 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
|
|||||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/dispatchReceiver.kt");
|
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")
|
@TestMetadata("genericPropertyAccess.kt")
|
||||||
public void testGenericPropertyAccess() throws Exception {
|
public void testGenericPropertyAccess() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/genericPropertyAccess.kt");
|
runTest("compiler/fir/resolve/testData/resolve/expresssions/genericPropertyAccess.kt");
|
||||||
|
|||||||
@@ -40,27 +40,28 @@ FILE fqName:<root> fileName:/genericPropertyReferenceType.kt
|
|||||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
PROPERTY name:y visibility:public modality:FINAL [var]
|
PROPERTY name:y visibility:public modality:FINAL [var]
|
||||||
FUN name:<get-y> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN name:<get-y> visibility:public modality:FINAL <> () returnType:T of <uninitialized parent>
|
||||||
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
|
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-y> (): IrErrorType declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-y> (): T of <uninitialized parent> declared in <root>'
|
||||||
ERROR_CALL 'Unresolved reference: <Unresolved name: x>#' type=IrErrorType
|
CALL 'public final fun <get-x> (): T of <uninitialized parent> declared in <root>.C' type=T of <uninitialized parent> origin=null
|
||||||
FUN name:<set-y> visibility:public modality:FINAL <> (v:IrErrorType) returnType:kotlin.Unit
|
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C<*> origin=null
|
||||||
|
FUN name:<set-y> visibility:public modality:FINAL <> (v:T of <uninitialized parent>) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
|
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
|
||||||
VALUE_PARAMETER name:v index:0 type:IrErrorType
|
VALUE_PARAMETER name:v index:0 type:T of <uninitialized parent>
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Unresolved name: x>#' type=IrErrorType
|
ERROR_CALL 'Unresolved reference: R|/C.x|' type=IrErrorType
|
||||||
FUN name:use visibility:public modality:FINAL <> (p:kotlin.reflect.KMutableProperty<kotlin.String>) returnType:kotlin.Unit
|
FUN name:use visibility:public modality:FINAL <> (p:kotlin.reflect.KMutableProperty<kotlin.String>) returnType:kotlin.Unit
|
||||||
VALUE_PARAMETER name:p index:0 type:kotlin.reflect.KMutableProperty<kotlin.String>
|
VALUE_PARAMETER name:p index:0 type:kotlin.reflect.KMutableProperty<kotlin.String>
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public final fun use (p: kotlin.reflect.KMutableProperty<kotlin.String>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
CALL 'public final fun use (p: kotlin.reflect.KMutableProperty<kotlin.String>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
p: PROPERTY_REFERENCE 'public final y: IrErrorType [var]' field=null getter='public final fun <get-y> (): IrErrorType declared in <root>' setter='public final fun <set-y> (v: IrErrorType): kotlin.Unit declared in <root>' type=IrErrorType origin=null
|
p: PROPERTY_REFERENCE 'public final y: T of <uninitialized parent> [var]' field=null getter='public final fun <get-y> (): T of <uninitialized parent> declared in <root>' setter='public final fun <set-y> (v: T of <uninitialized parent>): kotlin.Unit declared in <root>' type=T of <uninitialized parent> origin=null
|
||||||
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
|
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
|
||||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
TYPE_OP type=<root>.C<kotlin.String> origin=CAST typeOperand=<root>.C<kotlin.String>
|
TYPE_OP type=<root>.C<kotlin.String> origin=CAST typeOperand=<root>.C<kotlin.String>
|
||||||
GET_VAR 'a: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
GET_VAR 'a: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||||
CALL 'public final fun use (p: kotlin.reflect.KMutableProperty<kotlin.String>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
CALL 'public final fun use (p: kotlin.reflect.KMutableProperty<kotlin.String>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
p: PROPERTY_REFERENCE 'public final y: IrErrorType [var]' field=null getter='public final fun <get-y> (): IrErrorType declared in <root>' setter='public final fun <set-y> (v: IrErrorType): kotlin.Unit declared in <root>' type=IrErrorType origin=null
|
p: PROPERTY_REFERENCE 'public final y: T of <uninitialized parent> [var]' field=null getter='public final fun <get-y> (): T of <uninitialized parent> declared in <root>' setter='public final fun <set-y> (v: T of <uninitialized parent>): kotlin.Unit declared in <root>' type=T of <uninitialized parent> origin=null
|
||||||
|
|||||||
Reference in New Issue
Block a user