fixed bug: 'isStatement' for function body == 'hasBlockBody'

not vice versa
This commit is contained in:
Svetlana Isakova
2013-09-30 17:24:03 +04:00
parent fa8ca4e781
commit a3f9cef354
9 changed files with 25 additions and 9 deletions
@@ -0,0 +1,11 @@
fun foo1() = <!EXPRESSION_EXPECTED!>while (b()) {}<!>
fun foo2() = <!EXPRESSION_EXPECTED!>for (<!UNUSED_PARAMETER!>i<!> in <!ITERATOR_MISSING!>10<!>) {}<!>
fun foo3() = when (b()) {
true -> 1
else -> 0
}
fun b(): Boolean = true
@@ -42,8 +42,8 @@ fun box() : Int {
//More tests
fun test1() = while(true) {}
fun test2(): Unit = while(true) {}
fun test1() { while(true) {} }
fun test2(): Unit { while(true) {} }
fun testCoercionToUnit() {
val <!UNUSED_VARIABLE!>simple<!>: ()-> Unit = {
@@ -3,7 +3,7 @@
package a
//+JDK
fun <T> Array<T>.forEach(operation: (T) -> Unit) : Unit = for (element in this) operation(element)
fun <T> Array<T>.forEach(operation: (T) -> Unit) : Unit { for (element in this) operation(element) }
fun bar(operation: (String) -> Unit) = operation("")
@@ -9,7 +9,7 @@ class event<T>()
fun plusAssign(f : (T) -> Unit) = callbacks.add(f)
fun minusAssign(f : (T) -> Unit) = callbacks.remove(f)
fun call(value : T) = for(c in callbacks) c(value)
fun call(value : T) { for(c in callbacks) c(value) }
}
class MouseMovedEventArgs()
@@ -4,7 +4,7 @@
import java.util.*
fun <T> Iterator<T>.foreach(operation: (element: T) -> Unit) : Unit = while(hasNext()) operation(next())
fun <T> Iterator<T>.foreach(operation: (element: T) -> Unit) : Unit { while(hasNext()) operation(next()) }
fun <T> Iterator<T>.foreach(operation: (index: Int, element: T) -> Unit) : Unit {
var k = 0