Change parsing of statements starting with annotations

If a block statement starts with annotations treat them as they
belong to node of the statement rather than to the closest prefix expression

 #KT-10210 Fixed
This commit is contained in:
Denis Zharkov
2016-10-04 12:00:52 +03:00
parent 001a058529
commit 7353b08f09
12 changed files with 579 additions and 92 deletions
@@ -0,0 +1,25 @@
fun <T : CharSequence> foo(x: Array<Any>, y: IntArray, block: (T, Int) -> Int) {
var r: Any?
@Suppress("UNCHECKED_CAST")
r = block(x[0] as T, "" <!CAST_NEVER_SUCCEEDS!>as<!> Int)
// to prevent unused assignment diagnostic for the above statement
<!DEBUG_INFO_SMARTCAST!>r<!>.hashCode()
var i = 1
if (i != 1) {
@Suppress("UNCHECKED_CAST")
i += block(x[0] as T, "" <!CAST_NEVER_SUCCEEDS!>as<!> Int).toInt()
}
val l: () -> Unit = {
@Suppress("UNCHECKED_CAST")
i += block(x[0] as T, "" <!CAST_NEVER_SUCCEEDS!>as<!> Int).toInt()
}
l()
@Suppress("UNCHECKED_CAST")
y[i] += block(x[0] as T, "" <!CAST_NEVER_SUCCEEDS!>as<!> Int).toInt()
}
@@ -0,0 +1,3 @@
package
public fun </*0*/ T : kotlin.CharSequence> foo(/*0*/ x: kotlin.Array<kotlin.Any>, /*1*/ y: kotlin.IntArray, /*2*/ block: (T, kotlin.Int) -> kotlin.Int): kotlin.Unit