[FE] Make OverloadChecker take CR into account
This commit is contained in:
committed by
teamcity
parent
2bb155edc1
commit
343a860553
+18
@@ -10600,6 +10600,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflicting.kt")
|
||||||
|
public void testConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflictingWithDifferentOrder.kt")
|
||||||
|
public void testConflictingWithDifferentOrder() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("contextKeywordWithElvis.kt")
|
@TestMetadata("contextKeywordWithElvis.kt")
|
||||||
public void testContextKeywordWithElvis() throws Exception {
|
public void testContextKeywordWithElvis() throws Exception {
|
||||||
@@ -10684,6 +10696,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nonConflicting.kt")
|
||||||
|
public void testNonConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/nonConflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("outerClass.kt")
|
@TestMetadata("outerClass.kt")
|
||||||
public void testOuterClass() throws Exception {
|
public void testOuterClass() throws Exception {
|
||||||
|
|||||||
+18
@@ -10600,6 +10600,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflicting.kt")
|
||||||
|
public void testConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflictingWithDifferentOrder.kt")
|
||||||
|
public void testConflictingWithDifferentOrder() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("contextKeywordWithElvis.kt")
|
@TestMetadata("contextKeywordWithElvis.kt")
|
||||||
public void testContextKeywordWithElvis() throws Exception {
|
public void testContextKeywordWithElvis() throws Exception {
|
||||||
@@ -10684,6 +10696,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nonConflicting.kt")
|
||||||
|
public void testNonConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/nonConflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("outerClass.kt")
|
@TestMetadata("outerClass.kt")
|
||||||
public void testOuterClass() throws Exception {
|
public void testOuterClass() throws Exception {
|
||||||
|
|||||||
+18
@@ -10600,6 +10600,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflicting.kt")
|
||||||
|
public void testConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflictingWithDifferentOrder.kt")
|
||||||
|
public void testConflictingWithDifferentOrder() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("contextKeywordWithElvis.kt")
|
@TestMetadata("contextKeywordWithElvis.kt")
|
||||||
public void testContextKeywordWithElvis() throws Exception {
|
public void testContextKeywordWithElvis() throws Exception {
|
||||||
@@ -10684,6 +10696,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nonConflicting.kt")
|
||||||
|
public void testNonConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/nonConflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("outerClass.kt")
|
@TestMetadata("outerClass.kt")
|
||||||
public void testOuterClass() throws Exception {
|
public void testOuterClass() throws Exception {
|
||||||
|
|||||||
+12
-4
@@ -66,11 +66,19 @@ private fun <T> SimpleConstraintSystem.isValueParameterTypeNotLessSpecific(
|
|||||||
): Boolean {
|
): Boolean {
|
||||||
val typeParameters = general.typeParameters
|
val typeParameters = general.typeParameters
|
||||||
val typeSubstitutor = registerTypeVariables(typeParameters)
|
val typeSubstitutor = registerTypeVariables(typeParameters)
|
||||||
val valueParamsWithoutContextReceivers =
|
|
||||||
specific.valueParameterTypes.drop(specific.contextReceiverCount).map(typeKindSelector)
|
|
||||||
.zip(general.valueParameterTypes.drop(general.contextReceiverCount).map(typeKindSelector))
|
|
||||||
|
|
||||||
for ((specificType, generalType) in valueParamsWithoutContextReceivers) {
|
val specificContextReceiverCount = specific.contextReceiverCount
|
||||||
|
val generalContextReceiverCount = general.contextReceiverCount
|
||||||
|
|
||||||
|
var specificValueParameterTypes = specific.valueParameterTypes
|
||||||
|
var generalValueParameterTypes = general.valueParameterTypes
|
||||||
|
if (specificContextReceiverCount != generalContextReceiverCount) {
|
||||||
|
specificValueParameterTypes = specificValueParameterTypes.drop(specificContextReceiverCount)
|
||||||
|
generalValueParameterTypes = generalValueParameterTypes.drop(generalContextReceiverCount)
|
||||||
|
}
|
||||||
|
val valueParameters = specificValueParameterTypes.map(typeKindSelector).zip(generalValueParameterTypes.map(typeKindSelector))
|
||||||
|
|
||||||
|
for ((specificType, generalType) in valueParameters) {
|
||||||
if (specificType == null || generalType == null) continue
|
if (specificType == null || generalType == null) continue
|
||||||
|
|
||||||
if (specificityComparator.isDefinitelyLessSpecific(specificType, generalType)) {
|
if (specificityComparator.isDefinitelyLessSpecific(specificType, generalType)) {
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
context(A, B) public fun f(): kotlin.Unit
|
||||||
|
context(A, B) public fun f(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a: A, /*1*/ b: B): kotlin.Unit
|
||||||
|
|
||||||
|
public interface 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 interface 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
|
||||||
|
}
|
||||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(B, A)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
|
||||||
|
context(A, B)
|
||||||
|
fun f(): Unit = TODO()
|
||||||
|
|
||||||
|
context(B, A)
|
||||||
|
fun f(): Unit = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
context(A, B) public fun f(): kotlin.Unit
|
||||||
|
context(B, A) public fun f(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a: A, /*1*/ b: B): kotlin.Unit
|
||||||
|
|
||||||
|
public interface 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 interface 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
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
interface C
|
||||||
|
interface D
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A, B)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(C, D)
|
||||||
|
fun f(): Unit<!> = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
|
||||||
|
interface A
|
||||||
|
interface B
|
||||||
|
interface C
|
||||||
|
interface D
|
||||||
|
|
||||||
|
context(A, B)
|
||||||
|
fun f(): Unit = TODO()
|
||||||
|
|
||||||
|
context(C, D)
|
||||||
|
fun f(): Unit = TODO()
|
||||||
|
|
||||||
|
fun test(a: A, b: B) {
|
||||||
|
with(a) {
|
||||||
|
with(b) {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
context(A, B) public fun f(): kotlin.Unit
|
||||||
|
context(C, D) public fun f(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a: A, /*1*/ b: B): kotlin.Unit
|
||||||
|
|
||||||
|
public interface 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 interface 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
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface C {
|
||||||
|
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 interface D {
|
||||||
|
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
+18
@@ -10606,6 +10606,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflicting.kt")
|
||||||
|
public void testConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("conflictingWithDifferentOrder.kt")
|
||||||
|
public void testConflictingWithDifferentOrder() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("contextKeywordWithElvis.kt")
|
@TestMetadata("contextKeywordWithElvis.kt")
|
||||||
public void testContextKeywordWithElvis() throws Exception {
|
public void testContextKeywordWithElvis() throws Exception {
|
||||||
@@ -10690,6 +10702,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/noLabelsByClassName.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nonConflicting.kt")
|
||||||
|
public void testNonConflicting() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/nonConflicting.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("outerClass.kt")
|
@TestMetadata("outerClass.kt")
|
||||||
public void testOuterClass() throws Exception {
|
public void testOuterClass() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user