Refactorings: Support header/impl functions in member hierarchy transformations

#KT-18904 Fixed
 #KT-18905 Fixed
This commit is contained in:
Alexey Sedunov
2017-08-09 16:07:08 +03:00
parent 537c1fd063
commit 2f556e1bea
29 changed files with 183 additions and 13 deletions
@@ -0,0 +1,7 @@
// "Convert '(Int) -> Int' to 'Int.() -> Int'" "true"
header fun foo(n: Int, action: (<caret>Int) -> Int): Int
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,7 @@
// "Convert '(Int) -> Int' to 'Int.() -> Int'" "true"
header fun foo(n: Int, action: Int.() -> Int): Int
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
header fun foo(n: Int, action: (Int) -> Int): Int
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,5 @@
header fun foo(n: Int, action: Int.() -> Int): Int
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,7 @@
// "Convert '(Int) -> Int' to 'Int.() -> Int'" "true"
impl fun foo(n: Int, action: (<caret>Int) -> Int) = action(n)
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,7 @@
// "Convert '(Int) -> Int' to 'Int.() -> Int'" "true"
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { n -> n + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,7 @@
// "Convert 'Int.() -> Int' to '(Int) -> Int'" "true"
header fun foo(n: Int, action: <caret>Int.() -> Int): Int
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,7 @@
// "Convert 'Int.() -> Int' to '(Int) -> Int'" "true"
header fun foo(n: Int, action: (Int) -> Int): Int
fun test() {
foo(1) { i -> i + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { i -> i + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { i -> i + 1 }
}
@@ -0,0 +1,5 @@
header fun foo(n: Int, action: Int.() -> Int): Int
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
header fun foo(n: Int, action: (Int) -> Int): Int
fun test() {
foo(1) { i -> i + 1 }
}
@@ -0,0 +1,7 @@
// "Convert 'Int.() -> Int' to '(Int) -> Int'" "true"
impl fun foo(n: Int, action: <caret>Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,7 @@
// "Convert 'Int.() -> Int' to '(Int) -> Int'" "true"
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { i -> i + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: Int.() -> Int) = n.action()
fun test() {
foo(1) { this + 1 }
}
@@ -0,0 +1,5 @@
impl fun foo(n: Int, action: (Int) -> Int) = action(n)
fun test() {
foo(1) { i -> i + 1 }
}