tests added

for inference for delegated properties
This commit is contained in:
Svetlana Isakova
2013-06-05 15:27:12 +04:00
parent ef2af3a4e8
commit f41584c7ab
3 changed files with 60 additions and 0 deletions
@@ -0,0 +1,33 @@
package foo
class A1 {
val a: String by MyProperty1()
}
class MyProperty1 {}
fun MyProperty1.get(thisRef: Any?, desc: PropertyMetadata): String {
throw Exception("$thisRef $desc")
}
//--------------------
class A2 {
val a: String by MyProperty2()
}
class MyProperty2<T> {}
fun <T> MyProperty2<T>.get(thisRef: Any?, desc: PropertyMetadata): T {
throw Exception("$thisRef $desc")
}
//--------------------
class A3 {
val a: String by MyProperty3()
class MyProperty3<T> {}
fun <T> MyProperty3<T>.get(thisRef: Any?, desc: PropertyMetadata): T {
throw Exception("$thisRef $desc")
}
}
@@ -0,0 +1,17 @@
package foo
open class A {
val B.w: Int by <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>MyProperty<!>()
}
val A.e: Int by MyProperty()
class B {
val A.f: Int by MyProperty()
}
class MyProperty<R : A, T> {
public fun get(thisRef: R, desc: PropertyMetadata): T {
throw Exception("$thisRef $desc")
}
}