Don't discriminate generics during callable references resolution
^KT-49038 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
23f6c29efc
commit
abd2507107
+6
@@ -2747,6 +2747,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt37530.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49038.kt")
|
||||
public void testKt49038() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt49038.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
|
||||
+6
@@ -2747,6 +2747,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt37530.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49038.kt")
|
||||
public void testKt49038() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt49038.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
|
||||
+6
@@ -2747,6 +2747,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt37530.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49038.kt")
|
||||
public void testKt49038() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt49038.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
|
||||
@@ -197,7 +197,7 @@ class KotlinCallResolver(
|
||||
callableReferenceArgumentResolver.callableReferenceOverloadConflictResolver.chooseMaximallySpecificCandidates(
|
||||
refinedCandidates as Collection<CallableReferenceResolutionCandidate>,
|
||||
CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS,
|
||||
discriminateGenerics = true
|
||||
discriminateGenerics = false
|
||||
)
|
||||
} else {
|
||||
overloadingConflictResolver.chooseMaximallySpecificCandidates(
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fun take(arg: Any) {}
|
||||
|
||||
fun <T> foo(a: A, t: T) {} // 1
|
||||
fun <T> foo(b: B, t : T) {} // 2
|
||||
fun foo(i: Int) {} // 3
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
fun box(): String {
|
||||
val ref1 = take(::foo) // error before 1.6.20; ok, resolved to (3) since 1.6.20
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fun take(arg: Any) {}
|
||||
|
||||
fun <T> foo(a: A, t: T) {} // 1
|
||||
fun <T> foo(b: B, t : T) {} // 2
|
||||
fun foo(i: Int) {} // 3
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
fun box(): String {
|
||||
val ref1 = take(::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>foo<!>) // error before 1.6.20; ok, resolved to (3) since 1.6.20
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
public fun </*0*/ T> foo(/*0*/ a: A, /*1*/ t: T): kotlin.Unit
|
||||
public fun </*0*/ T> foo(/*0*/ b: B, /*1*/ t: T): kotlin.Unit
|
||||
public fun foo(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
public fun take(/*0*/ arg: kotlin.Any): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
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
|
||||
}
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
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
|
||||
}
|
||||
Generated
+6
@@ -2753,6 +2753,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt37530.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49038.kt")
|
||||
public void testKt49038() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/kt49038.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7430_wrongClassOnLHS.kt")
|
||||
public void testKt7430_wrongClassOnLHS() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user