Resolve expression in property delegate

This commit is contained in:
Natalia.Ukhorskaya
2013-04-30 15:35:25 +04:00
parent e143a53670
commit c58d4fd6d2
17 changed files with 391 additions and 42 deletions
@@ -0,0 +1,18 @@
trait A {
val prop: Int
}
class AImpl: A {
override val prop by Delegate()
}
fun foo() {
AImpl().prop
}
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,10 @@
class B {
val c by Delegate(<!UNRESOLVED_REFERENCE!>ag<!>)
}
class Delegate<T: Any>(val init: T) {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
throw Exception()
}
}
@@ -0,0 +1,13 @@
val a by <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>a<!>
val b by Delegate(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>b<!>)
val c by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>d<!>
val d by <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>c<!>
class Delegate(i: Int) {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,12 @@
val Int.a by Delegate(<!NO_THIS!>this<!>)
class A {
val Int.a by Delegate(<!TYPE_MISMATCH!>this<!>)
}
class Delegate(i: Int) {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,6 @@
~A~class A {
~foo~fun foo() = A()
}
val a: Int by `A`A().`foo`foo()
@@ -0,0 +1,4 @@
~A~class A
val a: Int by `A`A()
@@ -0,0 +1,5 @@
class A
val a: Int by `foo`foo()
~foo~fun foo() = A()
@@ -0,0 +1,4 @@
object ~A~A
val a: Int by `A`A
@@ -0,0 +1,6 @@
class A
~b~val b = A()
val a: Int by `b`b
@@ -0,0 +1,9 @@
~A~class A {
~foo~fun foo() = A()
}
class B {
val a: Int by `A`A().`foo`foo()
val b: Int by `A`A()
}
@@ -0,0 +1,11 @@
~A~class A {
~foo~fun foo() = A()
}
class B {
fun bar() {
val a: Int by `A`A().`foo`foo()
val b: Int by `A`A()
}
}