Create From Usage: Do not suggest "val" for references used as assignment left-hand side

This commit is contained in:
Alexey Sedunov
2014-10-03 16:38:38 +04:00
parent 58126b28ca
commit 865c793561
26 changed files with 180 additions and 49 deletions
@@ -0,0 +1,7 @@
// "Create local variable 'foo'" "true"
fun test(n: Int) {
var foo: Int
foo = n + 1
}
@@ -0,0 +1,5 @@
// "Create local variable 'foo'" "true"
fun test(n: Int) {
<caret>foo = n + 1
}
@@ -0,0 +1,7 @@
// "Create parameter 'foo'" "true"
class A(var foo: Int) {
fun test(n: Int) {
foo = n + 1
}
}
@@ -0,0 +1,8 @@
// "Create parameter 'foo'" "false"
// ACTION: Create local variable 'foo'
// ACTION: Create property 'foo' from usage
// ERROR: Unresolved reference: foo
fun test(n: Int) {
<caret>foo = n + 1
}
@@ -0,0 +1,7 @@
// "Create parameter 'foo'" "true"
class A {
fun test(n: Int) {
<caret>foo = n + 1
}
}
@@ -0,0 +1,10 @@
// "Create property 'foo' from usage" "true"
// ERROR: Property must be initialized
class A<T>(val n: T)
fun test() {
2.foo = A("2")
}
var Int.foo: A<String>
@@ -0,0 +1,11 @@
// "Create property 'foo' from usage" "true"
// ERROR: Property must be initialized or be abstract
class A<T>(val n: T) {
var foo: String
}
fun test() {
A(1).foo = "1"
}
@@ -0,0 +1,8 @@
// "Create property 'foo' from usage" "true"
// ERROR: Property must be initialized
class A<T>(val n: T)
fun test() {
2.<caret>foo = A("2")
}
@@ -0,0 +1,8 @@
// "Create property 'foo' from usage" "true"
// ERROR: Property must be initialized or be abstract
class A<T>(val n: T)
fun test() {
A(1).<caret>foo = "1"
}