Create from Usage: Support "Create member/extension" corresponding to the extension receiver of enclosing function
#KT-10668 Fixed (cherry picked from commit bc4c013)
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
fun bar(b: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun A.test() {
|
||||
bar(<caret>foo(n))
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
fun bar(b: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun A.test() {
|
||||
bar(foo(n))
|
||||
}
|
||||
|
||||
fun A.foo(n: Int): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
fun bar(b: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun test() {
|
||||
with(A(1)) {
|
||||
bar(<caret>foo(n))
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Create extension function 'foo'" "true"
|
||||
// WITH_RUNTIME
|
||||
fun bar(b: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
class A(val n: Int)
|
||||
|
||||
fun test() {
|
||||
with(A(1)) {
|
||||
bar(foo(n))
|
||||
}
|
||||
}
|
||||
|
||||
fun A.foo(n: Int): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
class A(val n: Int)
|
||||
|
||||
class B {
|
||||
val A.test: Boolean get() = <caret>foo
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
class A(val n: Int)
|
||||
|
||||
val A.foo: Boolean<caret>
|
||||
|
||||
class B {
|
||||
val A.test: Boolean get() = foo
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
class A(val n: Int)
|
||||
|
||||
class B {
|
||||
var A.test: Boolean
|
||||
get() = foo
|
||||
set(v: Boolean) {
|
||||
<caret>foo = v
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create extension property 'foo'" "true"
|
||||
// ERROR: Property must be initialized
|
||||
class A(val n: Int)
|
||||
|
||||
var A.foo: Boolean<caret>
|
||||
|
||||
class B {
|
||||
var A.test: Boolean
|
||||
get() = foo
|
||||
set(v: Boolean) {
|
||||
foo = v
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Create extension function 'foo'" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Create function 'foo'
|
||||
// ACTION: Rename reference
|
||||
// ERROR: Unresolved reference: foo
|
||||
fun bar(b: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
bar(<caret>foo(1))
|
||||
}
|
||||
Reference in New Issue
Block a user