Create From Usage: Do not suggest "val" for references used as assignment left-hand side
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
// "Create local variable 'foo'" "true"
|
||||
|
||||
fun test(n: Int) {
|
||||
var foo: Int
|
||||
|
||||
foo = n + 1
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create local variable 'foo'" "true"
|
||||
|
||||
fun test(n: Int) {
|
||||
<caret>foo = n + 1
|
||||
}
|
||||
+7
@@ -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
|
||||
}
|
||||
+7
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user