Inline refactoring: shouldn't lose return type information

#KT-26705 Fixed
This commit is contained in:
Dmitry Gridin
2020-06-26 12:34:34 +07:00
parent c3b726f10a
commit 30f98e6730
13 changed files with 121 additions and 14 deletions
@@ -0,0 +1,9 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
buildMyList<caret>(5)
}
private fun buildMyList(count: Int): List<String> {
return buildList(size = count)
}
@@ -0,0 +1,6 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
buildList<String>(size = 5)
}
@@ -0,0 +1,10 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
buildMyList<caret>(5)
}
private fun buildMyList(count: Int): List<String> {
buildList(size = count)
return buildList(size = count)
}
@@ -0,0 +1,7 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
buildList(size = 5)
buildList<String>(size = 5)
}
@@ -0,0 +1,10 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
buildMyList<caret>(5)
}
private fun buildMyList(count: Int): List<String> {
val b: List<Int> = buildList(size = count)
return buildList(size = count)
}
@@ -0,0 +1,7 @@
fun <T> buildList(size: Int) = listOf<T>()
fun f() {
val b: List<Int> = buildList(size = 5)
buildList<String>(size = 5)
}
@@ -0,0 +1,9 @@
fun <T> buildType(size: Int): T = TODO()
fun f() {
buildMyList<caret>(5)
}
private fun buildMyList(count: Int) {
return buildType(size = count)
}
@@ -0,0 +1,6 @@
fun <T> buildType(size: Int): T = TODO()
fun f() {
buildType<Unit>(size = 5)
}
@@ -0,0 +1,11 @@
fun <T> buildList(size: Int) = listOf<T>()
class Test {
fun f() {
val list = buildMyList(5)
}
private fun buildMyList<caret>(count: Int): List<String> {
return buildList(size = count)
}
}
@@ -0,0 +1,8 @@
fun <T> buildList(size: Int) = listOf<T>()
class Test {
fun f() {
val list = buildList<String>(size = 5)
}
}