data deprecations (empty constructors, non val/var arguments, vararg, superclasses) are now errors, relevant tests fixed

This commit is contained in:
Mikhail Glukhikh
2015-10-16 17:10:39 +03:00
parent cae0388a57
commit a4af6a3076
32 changed files with 41 additions and 156 deletions
@@ -1,17 +0,0 @@
data class A(a: Int, b: String) {}
fun box() : String {
for (method in javaClass<A>().getDeclaredMethods()) {
if (method.getName() == "copy"){
val parameterTypes = method.getParameterTypes()
if (parameterTypes != null && parameterTypes.size() == 2) {
val copy = A(1, "a").copy(a = 2, b = "b")
return "OK"
}
else {
return "Method copy has " + (if (parameterTypes == null) "0" else parameterTypes.size()) + " parameters, expected 2"
}
}
}
return "fail"
}
@@ -1,4 +1,4 @@
data class A()
data class A(val arg: Any? = null)
fun box() : String {
val a = A()
@@ -1,13 +1,13 @@
data class A(val a: Any?, var x: Int)
data class B(val a: Any?, x: Int)
data class B(val a: Any?)
data class C(val a: Int, var x: Int?)
data class D(val a: Int?)
fun box() : String {
if( A(null,19).hashCode() != 19) "fail"
if( A(239,19).hashCode() != (239*31+19)) "fail"
if( B(null,19).hashCode() != 0) "fail"
if( B(239,19).hashCode() != 239) "fail"
if( B(null).hashCode() != 0) "fail"
if( B(239).hashCode() != 239) "fail"
if( C(239,19).hashCode() != (239*31+19)) "fail"
if( C(239,null).hashCode() != 239*31) "fail"
if( D(239).hashCode() != (239)) "fail"
@@ -1,7 +1,7 @@
data class A(var x: Int, y: Int, val z: Int)
data class A(var x: Int, val z: Int)
fun box(): String {
val a = A(1, 2, 3)
val a = A(1, 3)
if (a.component1() != 1) return "Fail: ${a.component1()}"
if (a.component2() != 3) return "Fail: ${a.component2()}"
return "OK"
@@ -1,10 +0,0 @@
abstract class SuperTrait {
override fun toString(): String = "!"
}
data class A(val x: Int): SuperTrait() {
}
fun box(): String {
return if (A(0).toString() == "!") "OK" else "fail"
}
@@ -1,7 +1,7 @@
data class A(var x: Int, y: Int, val z: Int?)
data class A(var x: Int, val z: Int?)
fun box(): String {
val a = A(1, 2, null)
val a = A(1, null)
if("$a" != "A(x=1, z=null)") return "$a"
return "OK"
}