FIR: postpone callable reference candidate in default argument case
#KT-53019 Fixed
This commit is contained in:
+12
@@ -17721,6 +17721,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/fir/callableReferenceToStaticFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cannotCastToFunction.kt")
|
||||
public void testCannotCastToFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cannotCastToFunctionInIf.kt")
|
||||
public void testCannotCastToFunctionInIf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/cannotCastToFunctionInIf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClassBuilder.kt")
|
||||
public void testClassBuilder() throws Exception {
|
||||
|
||||
Generated
+6
@@ -2494,6 +2494,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/candidateSymbol.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cannotCastToFunction.kt")
|
||||
public void testCannotCastToFunction() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClashResolutionDescriptor.kt")
|
||||
public void testClashResolutionDescriptor() throws Exception {
|
||||
|
||||
+6
@@ -2494,6 +2494,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
|
||||
runTest("compiler/testData/ir/irText/firProblems/candidateSymbol.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("cannotCastToFunction.kt")
|
||||
public void testCannotCastToFunction() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/cannotCastToFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ClashResolutionDescriptor.kt")
|
||||
public void testClashResolutionDescriptor() throws Exception {
|
||||
|
||||
@@ -456,6 +456,19 @@ class FirCallResolver(
|
||||
}
|
||||
|
||||
val chosenCandidate = reducedCandidates.single()
|
||||
if (!resolvedCallableReferenceAtom.hasBeenPostponed &&
|
||||
expectedType is ConeTypeVariableType &&
|
||||
chosenCandidate.symbol.fir.let { func ->
|
||||
func is FirSimpleFunction && func.valueParameters.any { param ->
|
||||
param.defaultValue != null
|
||||
}
|
||||
}
|
||||
) {
|
||||
resolvedCallableReferenceAtom.hasBeenPostponed = true
|
||||
return applicability to true
|
||||
}
|
||||
|
||||
|
||||
constraintSystemBuilder.runTransaction {
|
||||
chosenCandidate.outerConstraintBuilderEffect!!(this)
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user