[FIR] Create error type instead of implicit type for incorrect functional types
This commit is contained in:
@@ -856,7 +856,7 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder
|
|||||||
isNullable,
|
isNullable,
|
||||||
unwrappedElement.receiverTypeReference.convertSafe(),
|
unwrappedElement.receiverTypeReference.convertSafe(),
|
||||||
// TODO: probably implicit type should not be here
|
// TODO: probably implicit type should not be here
|
||||||
unwrappedElement.returnTypeReference.toFirOrImplicitType()
|
unwrappedElement.returnTypeReference.toFirOrErrorType()
|
||||||
)
|
)
|
||||||
for (valueParameter in unwrappedElement.parameters) {
|
for (valueParameter in unwrappedElement.parameters) {
|
||||||
functionType.valueParameters += valueParameter.convert<FirValueParameter>()
|
functionType.valueParameters += valueParameter.convert<FirValueParameter>()
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fun foo(func: (Int).Int -> Int) {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>foo<!> {
|
||||||
|
this + <!UNRESOLVED_REFERENCE!>it<!>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
FILE: incorrectFunctionalType.kt
|
||||||
|
public final fun foo(func: R|kotlin/Int.() -> class error: Incomplete code|, Int: <implicit>): R|kotlin/Unit|
|
||||||
|
fun <anonymous>(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
public final fun test(): R|kotlin/Unit| {
|
||||||
|
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(<L> = foo@fun <implicit>.<anonymous>(): R|kotlin/String| {
|
||||||
|
this#.R|kotlin/plus|(<Unresolved name: it>#)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
+5
@@ -240,6 +240,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
|||||||
runTest("compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt");
|
runTest("compiler/fir/resolve/testData/resolve/arguments/fieldPlusAssign.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("incorrectFunctionalType.kt")
|
||||||
|
public void testIncorrectFunctionalType() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/arguments/incorrectFunctionalType.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("invoke.kt")
|
@TestMetadata("invoke.kt")
|
||||||
public void testInvoke() throws Exception {
|
public void testInvoke() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/arguments/invoke.kt");
|
runTest("compiler/fir/resolve/testData/resolve/arguments/invoke.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user