KT-2166 Control flow analysis doesn't detect that a 'while(true)' loop never terminates
KT-2103 Compiler requires return statement after loop which never exits #KT-2166 Fixed #KT-2103 Fixed
This commit is contained in:
+5
-2
@@ -118,8 +118,11 @@ fun bar(<!UNUSED_PARAMETER!>a<!>: Unit) {}
|
||||
fun testStatementInExpressionContext() {
|
||||
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>z<!> = 34
|
||||
val <!UNUSED_VARIABLE!>a1<!>: Unit = <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>z = <!UNUSED_VALUE!>334<!><!>
|
||||
val <!UNUSED_VARIABLE!>a2<!>: Unit = <!EXPRESSION_EXPECTED!>while(true) {}<!>
|
||||
val <!UNUSED_VARIABLE!>f<!> = <!EXPRESSION_EXPECTED!>for (i in 1..10) {}<!>
|
||||
if (true) return <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>z = <!UNUSED_VALUE!>34<!><!>
|
||||
return <!EXPRESSION_EXPECTED!>while (true) {}<!>
|
||||
<!UNREACHABLE_CODE!>return <!EXPRESSION_EXPECTED!>while (true) {}<!><!>
|
||||
}
|
||||
|
||||
fun testStatementInExpressionContext2() {
|
||||
<!UNREACHABLE_CODE!>val <!UNUSED_VARIABLE!>a2<!>: Unit = <!EXPRESSION_EXPECTED!>while(true) {}<!><!>
|
||||
}
|
||||
Reference in New Issue
Block a user