Inline: support compound case without containing block #KT-17296 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-04-14 10:35:00 +03:00
parent ade838bff2
commit e6fa7356e1
12 changed files with 103 additions and 2 deletions
@@ -0,0 +1,6 @@
interface DelegateFace
fun compoundDelegate(): DelegateFace {
val result = object : DelegateFace {}
return result
}
class DelegatingB : DelegateFace by <caret>compoundDelegate()
@@ -0,0 +1,5 @@
interface DelegateFace
class DelegatingB : DelegateFace by run {
val result = object : DelegateFace {}
result
}
@@ -0,0 +1,8 @@
fun provideSimple() = listOf("statement 0")
fun provideComplex(): MutableList<String> {
val result = mutableListOf("statement 1")
result.add("statement 2")
return result
}
fun callInDefault(simple: List<String> = provideSimple(), complex: List<String> = <caret>provideComplex()) {
}
@@ -0,0 +1,7 @@
fun provideSimple() = listOf("statement 0")
fun callInDefault(simple: List<String> = provideSimple(), complex: List<String> = run {
val result = mutableListOf("statement 1")
result.add("statement 2")
result
}) {
}
@@ -0,0 +1,10 @@
fun compound(): String {
val s = "Hello"
return s
}
fun outer() {
class Container {
val v = <caret>compound()
}
}
@@ -0,0 +1,7 @@
fun outer() {
val s = "Hello"
class Container {
val v = s
}
}
@@ -0,0 +1,8 @@
fun compound(): String {
val s = "Hello"
return s
}
class Container {
val v = <caret>compound()
}
@@ -0,0 +1,6 @@
class Container {
val v = run {
val s = "Hello"
s
}
}
@@ -0,0 +1,6 @@
fun compound(): String {
val s = "Hello"
return s
}
val v = <caret>compound()
@@ -0,0 +1,4 @@
val v = run {
val s = "Hello"
s
}