Make proper scope for property declaration

Make sure same scope is used for both property creation and for properly body resolution.
This fixes KT-421 Strange 'unresolved' bug with backing fields.
This commit is contained in:
Stepan Koltsov
2011-11-30 20:48:37 +04:00
parent 49c29dd323
commit aa4c6e8e8e
13 changed files with 276 additions and 141 deletions
@@ -243,7 +243,7 @@ class Outer() {
}
class ForwardAccessToBackingField() { //kt-147
val a = <!UNRESOLVED_REFERENCE, UNINITIALIZED_VARIABLE!>$a<!> // error
val a = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, UNINITIALIZED_VARIABLE!>$a<!> // error
val b = <!UNINITIALIZED_VARIABLE!>$c<!> // error
val c = 1
}
@@ -349,4 +349,4 @@ fun test(m : M) {
fun test1(m : M) {
<!VAL_REASSIGNMENT!>m.x<!>++
m.y--
}
}
@@ -1,3 +1,3 @@
class Cyclic() {
val a = <!UNRESOLVED_REFERENCE, UNINITIALIZED_VARIABLE!>$a<!>
val a = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, UNINITIALIZED_VARIABLE!>$a<!>
}
@@ -0,0 +1,8 @@
// http://youtrack.jetbrains.net/issue/KT-421
// KT-421 Strange 'unresolved' bug with backing fields
class A() {
val c = 1
val a = <!UNINITIALIZED_VARIABLE!>b<!>
val b = $c // '$c' is unresolved
}