Modify analysis for property initializer. Add errors about delegated property accessors.

This commit is contained in:
Natalia.Ukhorskaya
2013-04-26 10:52:20 +04:00
parent 171144e641
commit e7bf3b141f
16 changed files with 246 additions and 15 deletions
@@ -0,0 +1,8 @@
val a: Int by Delegate()
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,8 @@
val a by Delegate()
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,10 @@
abstract class A {
abstract val a: Int <!ABSTRACT_DELEGATED_PROPERTY!>by Delegate()<!>
}
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,13 @@
class B {
val a: Int by Delegate()
fun foo() = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
}
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,10 @@
trait T {
val a: Int <!DELEGATED_PROPERTY_IN_TRAIT!>by Delegate()<!>
}
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,12 @@
class Local {
fun foo() {
val <!UNUSED_VARIABLE!>a<!>: Int <!LOCAL_VARIABLE_WITH_DELEGATE!>by Delegate()<!>
}
}
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,8 @@
<!PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE!>public val a<!> by Delegate()
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,9 @@
val a: Int by Delegate()
<!ACCESSOR_FOR_DELEGATED_PROPERTY!>get() = 1<!>
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
}
@@ -0,0 +1,14 @@
var a: Int by Delegate()
<!ACCESSOR_FOR_DELEGATED_PROPERTY!>get() = 1<!>
<!ACCESSOR_FOR_DELEGATED_PROPERTY!>set(i) {}<!>
class Delegate {
fun get(t: Any?, p: String): Int {
t.equals(p) // to avoid UNUSED_PARAMETER warning
return 1
}
fun set(t: Any?, p: String, i: Int) {
t.equals(p) || i.equals(null) // to avoid UNUSED_PARAMETER warning
}
}