[FIR] Fix overload conflicts resolution for callable references with defaults

This commit is contained in:
Dmitriy Novozhilov
2021-05-13 12:40:58 +03:00
committed by teamcityserver
parent e3b92fd561
commit 1a3b5657c7
8 changed files with 77 additions and 1 deletions
@@ -2345,6 +2345,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
}
@Test
@TestMetadata("overloadResolutionWithDefaults.kt")
public void testOverloadResolutionWithDefaults() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/overloadResolutionWithDefaults.kt");
}
@Test
@TestMetadata("packageInLhs.kt")
public void testPackageInLhs() throws Exception {
@@ -2345,6 +2345,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
}
@Test
@TestMetadata("overloadResolutionWithDefaults.kt")
public void testOverloadResolutionWithDefaults() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/overloadResolutionWithDefaults.kt");
}
@Test
@TestMetadata("packageInLhs.kt")
public void testPackageInLhs() throws Exception {
@@ -105,6 +105,9 @@ class Candidate(
set(value) {
field = value
usesSuspendConversion = value?.suspendConversionStrategy == SuspendConversionStrategy.SUSPEND_CONVERSION
if (value != null) {
numDefaults = value.defaults
}
}
var usesSuspendConversion: Boolean = false
@@ -0,0 +1,29 @@
// FIR_IDENTICAL
class ShortenReferences {
companion object {
val DEFAULT = ShortenReferences()
}
fun process(
element: String,
elementFilter: (String) -> Int = { 10 },
actionRunningMode: String = ""
): String {
return "hello"
}
fun process(
element: String,
elementFilter: (String) -> Int = { 10 },
): String {
return "hello"
}
}
fun takeReference(block: (String) -> Unit) {}
fun test() {
takeReference(ShortenReferences.DEFAULT::process)
}
@@ -0,0 +1,21 @@
package
public fun takeReference(/*0*/ block: (kotlin.String) -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public final class ShortenReferences {
public constructor ShortenReferences()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun process(/*0*/ element: kotlin.String, /*1*/ elementFilter: (kotlin.String) -> kotlin.Int = ...): kotlin.String
public final fun process(/*0*/ element: kotlin.String, /*1*/ elementFilter: (kotlin.String) -> kotlin.Int = ..., /*2*/ actionRunningMode: kotlin.String = ...): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public companion object Companion {
private constructor Companion()
public final val DEFAULT: ShortenReferences
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -2351,6 +2351,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
}
@Test
@TestMetadata("overloadResolutionWithDefaults.kt")
public void testOverloadResolutionWithDefaults() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/overloadResolutionWithDefaults.kt");
}
@Test
@TestMetadata("packageInLhs.kt")
public void testPackageInLhs() throws Exception {
@@ -110,4 +110,4 @@ class OverridesCompletion(
else -> return false
}
}
}
}
@@ -2010,6 +2010,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
}
@TestMetadata("overloadResolutionWithDefaults.kt")
public void testOverloadResolutionWithDefaults() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/overloadResolutionWithDefaults.kt");
}
@TestMetadata("packageInLhs.kt")
public void testPackageInLhs() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/packageInLhs.kt");