Create from Usage: Implement 'Create property as constructor parameter' quick-fix
#KT-8426 Fixed
This commit is contained in:
+1
@@ -1,6 +1,7 @@
|
||||
// "Create local variable 'foo'" "false"
|
||||
// ACTION: Create extension property 'foo'
|
||||
// ACTION: Create member property 'foo'
|
||||
// ACTION: Create property 'foo' as constructor parameter
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
fun test(n: Int) {
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A(var foo: Int) {
|
||||
fun test(n: Int) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
val test: Int get() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A(val foo: Int) {
|
||||
val test: Int get() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T> {
|
||||
val test: T get() {
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val foo: T) {
|
||||
val test: T get() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
val test: Int get() = <caret>foo
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A(val foo: Int) {
|
||||
val test: Int get() = foo
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
// ERROR: No value passed for parameter foo
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Create parameter 'foo'" "true"
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
// ERROR: No value passed for parameter foo
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// "Create parameter 'foo'" "false"
|
||||
// ACTION: Create extension property 'foo'
|
||||
// ACTION: Create member property 'foo'
|
||||
// ACTION: Create property 'foo' as constructor parameter
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Create property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create parameter 'foo'
|
||||
// ACTION: Create local variable 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test() {
|
||||
fun nestedTest(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
class B {
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
class B(val foo: Int) {
|
||||
fun test(): Int {
|
||||
return foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
class B {
|
||||
fun test(): Int {
|
||||
<caret>foo = 1
|
||||
return foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A {
|
||||
class B(var foo: Int) {
|
||||
fun test(): Int {
|
||||
<caret>foo = 1
|
||||
return foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// "Create property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create local variable 'foo'
|
||||
// ACTION: Create parameter 'foo'
|
||||
// ACTION: Create property 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A {
|
||||
object B {
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class J {
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create member property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Create member property 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test() {
|
||||
val a: Int = J.<caret>foo
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
fun test(): A<Int> {
|
||||
return this.<caret>foo
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T, val foo: A<Int>) {
|
||||
fun test(): A<Int> {
|
||||
return this.foo
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun <U> A<U>.test(): A<Int> {
|
||||
return this.<caret>foo
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T, val foo: A<Int>)
|
||||
|
||||
fun <U> A<U>.test(): A<Int> {
|
||||
return this.<caret>foo
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test(): A<Int> {
|
||||
return this.<caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U, val foo: A<Int>) {
|
||||
fun test(): A<Int> {
|
||||
return this.foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test(): A<Int> {
|
||||
return this@A.<caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
|
||||
class A<T>(val n: T, val foo: A<Int>) {
|
||||
inner class B<U>(val m: U) {
|
||||
fun test(): A<Int> {
|
||||
return this@A.foo
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Create property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Create property 'foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create local variable 'foo'
|
||||
// ACTION: Create parameter 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>foo
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// "Create member property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Create member property 'foo'
|
||||
// ACTION: Create extension property 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A<T>(val n: T) {
|
||||
companion object {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a: Int = A.<caret>foo
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Create member property 'foo'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create extension property 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
fun test(): String? {
|
||||
return A().<caret>foo
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create property 'foo' as constructor parameter" "false"
|
||||
// ACTION: Create extension property 'foo'
|
||||
// ERROR: Unresolved reference: foo
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = 2.<caret>foo
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = A(1).<caret>foo
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
class A<T>(val n: T, val foo: A<Int>)
|
||||
|
||||
fun test() {
|
||||
val a: A<Int> = A(1, ).foo
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
fun test() {
|
||||
A(1).<caret>foo = "1"
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: No value passed for parameter foo
|
||||
|
||||
class A<T>(val n: T, var foo: String)
|
||||
|
||||
fun test() {
|
||||
A(1, ).foo = "1"
|
||||
}
|
||||
Reference in New Issue
Block a user