mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +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
14 lines
348 B
Kotlin
Vendored
14 lines
348 B
Kotlin
Vendored
// LANGUAGE_VERSION: 1.0
|
|
|
|
data class Foo(val s: String)
|
|
|
|
fun box(): String {
|
|
val f1 = Foo("OK")
|
|
val f2 = Foo("OK")
|
|
if (f1 != f2) return "Fail equals"
|
|
if (f1.hashCode() != f2.hashCode()) return "Fail hashCode"
|
|
if (f1.toString() != f2.toString() || f1.toString() != "Foo(s=OK)") return "Fail toString: $f1 $f2"
|
|
|
|
return f1.s
|
|
}
|