tests added
for inference for delegated properties
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user