KT-62138 add testcases
This commit is contained in:
committed by
Space Team
parent
079343c093
commit
af63763da2
+6
@@ -26566,6 +26566,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguityExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignOperatorWithExtensionForAny.kt")
|
||||
public void testAssignOperatorWithExtensionForAny() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorWithExtensionForAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignmentOperations.kt")
|
||||
public void testAssignmentOperations() throws Exception {
|
||||
|
||||
+6
@@ -26566,6 +26566,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguityExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignOperatorWithExtensionForAny.kt")
|
||||
public void testAssignOperatorWithExtensionForAny() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorWithExtensionForAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignmentOperations.kt")
|
||||
public void testAssignmentOperations() throws Exception {
|
||||
|
||||
+6
@@ -24566,6 +24566,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguityExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignOperatorWithExtensionForAny.kt")
|
||||
public void testAssignOperatorWithExtensionForAny() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorWithExtensionForAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignmentOperations.kt")
|
||||
public void testAssignmentOperations() throws Exception {
|
||||
|
||||
+6
@@ -24572,6 +24572,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguityExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignOperatorWithExtensionForAny.kt")
|
||||
public void testAssignOperatorWithExtensionForAny() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorWithExtensionForAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignmentOperations.kt")
|
||||
public void testAssignmentOperations() throws Exception {
|
||||
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
class Y
|
||||
class Z
|
||||
|
||||
class HashMap<K, V>(
|
||||
private val defaultValue: V
|
||||
) {
|
||||
operator fun get(key: K): V = defaultValue
|
||||
operator fun set(key: K, value: V) {}
|
||||
}
|
||||
|
||||
private operator fun Any.plusAssign(p: Any) { }
|
||||
private operator fun Any.plus(p: Any): Any = Any()
|
||||
|
||||
class Base {
|
||||
private val x = HashMap<Y, Z>(Z())
|
||||
|
||||
fun foo(): Z {
|
||||
val y = Y()
|
||||
val z = Z()
|
||||
x[y] += z
|
||||
return x[y]
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class C {
|
||||
operator fun get(i: Int): C = this
|
||||
}
|
||||
|
||||
operator fun C.plus(a: Any): C = this
|
||||
operator fun C.plusAssign(a: Any) {}
|
||||
|
||||
class C1 {
|
||||
operator fun get(i: Int): C = C()
|
||||
operator fun set(i: Int, v: C) {}
|
||||
}
|
||||
|
||||
class C2 {
|
||||
operator fun set(i: Int, v: C2) {}
|
||||
operator fun get(i: Int): C2 = this
|
||||
}
|
||||
|
||||
operator fun C2.plus(a: Any):C2 = this
|
||||
|
||||
fun test() {
|
||||
val c = C()
|
||||
c[0] += ""
|
||||
var c1 = C1()
|
||||
c1[0] <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> ""
|
||||
var c2 = C2()
|
||||
c2[0] += ""
|
||||
}
|
||||
+9
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class C {
|
||||
@@ -13,9 +12,18 @@ class C1 {
|
||||
operator fun set(i: Int, v: C) {}
|
||||
}
|
||||
|
||||
class C2 {
|
||||
operator fun set(i: Int, v: C2) {}
|
||||
operator fun get(i: Int): C2 = this
|
||||
}
|
||||
|
||||
operator fun C2.plus(a: Any):C2 = this
|
||||
|
||||
fun test() {
|
||||
val c = C()
|
||||
c[0] += ""
|
||||
var c1 = C1()
|
||||
c1[0] <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> ""
|
||||
var c2 = C2()
|
||||
c2<!NO_SET_METHOD!>[0]<!> += ""
|
||||
}
|
||||
+10
@@ -2,6 +2,7 @@ package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
public operator fun C.plus(/*0*/ a: kotlin.Any): C
|
||||
public operator fun C2.plus(/*0*/ a: kotlin.Any): C2
|
||||
public operator fun C.plusAssign(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
|
||||
public final class C {
|
||||
@@ -20,3 +21,12 @@ public final class C1 {
|
||||
public final operator fun set(/*0*/ i: kotlin.Int, /*1*/ v: C): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C2 {
|
||||
public constructor C2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun get(/*0*/ i: kotlin.Int): C2
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun set(/*0*/ i: kotlin.Int, /*1*/ v: C2): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Generated
+6
@@ -26566,6 +26566,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguityExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignOperatorWithExtensionForAny.kt")
|
||||
public void testAssignOperatorWithExtensionForAny() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorWithExtensionForAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("AssignmentOperations.kt")
|
||||
public void testAssignmentOperations() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user