mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
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
24 lines
707 B
Kotlin
Vendored
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
|