check definite return in local functions

This commit is contained in:
Svetlana Isakova
2013-11-29 19:53:18 +04:00
parent d27c8b7d61
commit 8e27877817
6 changed files with 96 additions and 11 deletions
@@ -0,0 +1,13 @@
trait X {
fun f(): Boolean
}
val m = object : X {
override fun f(): Boolean {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun foo() {
fun local(): Int {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
}
}
@@ -0,0 +1,17 @@
package f
//KT-3444 Front-end doesn't check if local function or function of anonymous class returns value
fun box(): Int {
fun local(): Int {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
return local()
}
fun main(args: Array<String>) {
box()
}