Files
kotlin/compiler/testData/diagnostics/tests/sourceCompatibility/noDataClassInheritance.kt
Alexander Udalov 73652f309f Do not create synthesized equals/hashCode/toString in data classes in compatibility mode
To simplify migration from 1.0 to 1.1, do not allow data classes to
automatically implement abstract equals/hashCode/toString declared in
super-interfaces (KT-11306) if "-language-version 1.0" is specified
2016-10-04 10:24:41 +03:00

24 lines
707 B
Kotlin
Vendored

// !LANGUAGE: -DataClassInheritance
interface Allowed
open class NotAllowed
<!INCOMPATIBLE_MODIFIERS!>abstract<!> <!INCOMPATIBLE_MODIFIERS!>data<!> class Base(val x: Int)
class Derived: Base(42)
<!DATA_CLASS_OVERRIDE_CONFLICT!>data<!> class Nasty(val z: Int, val y: Int): <!DATA_CLASS_CANNOT_HAVE_CLASS_SUPERTYPES!>Base<!>(z)
data class Complex(val y: Int): Allowed, <!DATA_CLASS_CANNOT_HAVE_CLASS_SUPERTYPES!>NotAllowed<!>()
interface AbstractEqualsHashCodeToString {
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
override fun toString(): String
}
data <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class ImplInterface<!>(val s: String) : AbstractEqualsHashCodeToString