KT-33132: Add diagnostics test showing that issue is fixed in K2

^KT-33132: Fixed
This commit is contained in:
Stanislav Ruban
2023-01-03 19:12:19 +02:00
committed by Space Team
parent 4542b3947b
commit 0f179e8949
6 changed files with 111 additions and 0 deletions
@@ -22756,6 +22756,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/compareToNullable.kt");
}
@Test
@TestMetadata("EqualsOperatorOverrideHierarchies.kt")
public void testEqualsOperatorOverrideHierarchies() throws Exception {
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/EqualsOperatorOverrideHierarchies.kt");
}
@Test
@TestMetadata("incForAssignmentSmartCast.kt")
public void testIncForAssignmentSmartCast() throws Exception {
@@ -22750,6 +22750,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/compareToNullable.kt");
}
@Test
@TestMetadata("EqualsOperatorOverrideHierarchies.kt")
public void testEqualsOperatorOverrideHierarchies() throws Exception {
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/EqualsOperatorOverrideHierarchies.kt");
}
@Test
@TestMetadata("incForAssignmentSmartCast.kt")
public void testIncForAssignmentSmartCast() throws Exception {
@@ -0,0 +1,25 @@
open class Parent {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
open class OperatorParent {
override operator fun equals(other: Any?): Boolean =
super.equals(other)
}
class A : Parent() {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
class B : OperatorParent() {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
class C : Parent() {
override operator fun equals(other: Any?): Boolean = // false positive in K1, OK in K2
super.equals(other) //
}
class D : OperatorParent() {
override operator fun equals(other: Any?): Boolean = // false positive in K1, OK in K2
super.equals(other)
}
@@ -0,0 +1,25 @@
open class Parent {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
open class OperatorParent {
override operator fun equals(other: Any?): Boolean =
super.equals(other)
}
class A : Parent() {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
class B : OperatorParent() {
override fun equals(other: Any?): Boolean =
super.equals(other)
}
class C : Parent() {
override <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: Any?): Boolean = // false positive in K1, OK in K2
super.equals(other) //
}
class D : OperatorParent() {
override <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: Any?): Boolean = // false positive in K1, OK in K2
super.equals(other)
}
@@ -0,0 +1,43 @@
package
public final class A : Parent {
public constructor A()
public open override /*1*/ 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 : OperatorParent {
public constructor B()
public open override /*1*/ 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 C : Parent {
public constructor C()
public open override /*1*/ 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 D : OperatorParent {
public constructor D()
public open override /*1*/ 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 open class OperatorParent {
public constructor OperatorParent()
public open override /*1*/ 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 open class Parent {
public constructor Parent()
public open override /*1*/ 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
}
@@ -22756,6 +22756,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/compareToNullable.kt");
}
@Test
@TestMetadata("EqualsOperatorOverrideHierarchies.kt")
public void testEqualsOperatorOverrideHierarchies() throws Exception {
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/EqualsOperatorOverrideHierarchies.kt");
}
@Test
@TestMetadata("incForAssignmentSmartCast.kt")
public void testIncForAssignmentSmartCast() throws Exception {