KT-22274 report warning on labels that can't be referenced

Labels are meaningful only if they can be referenced by 'break',
'continue', or 'return' expressions.
This commit is contained in:
Dmitry Petrov
2018-07-24 15:58:10 +03:00
parent 6fb913a463
commit df6d4f358a
28 changed files with 127 additions and 42 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ class C {
fun f (<!UNUSED_PARAMETER!>a<!> : Boolean, <!UNUSED_PARAMETER!>b<!> : Boolean) {
b@ while (true)
a@ {
<!REDUNDANT_LABEL_WARNING!>a@<!> {
<!NOT_A_LOOP_LABEL!>break@f<!>
break
<!UNREACHABLE_CODE!>break@b<!>
@@ -12,7 +12,7 @@ class C {
<!BREAK_OR_CONTINUE_OUTSIDE_A_LOOP!>continue<!>
b@ while (true)
a@ {
<!REDUNDANT_LABEL_WARNING!>a@<!> {
<!NOT_A_LOOP_LABEL!>continue@f<!>
continue
<!UNREACHABLE_CODE!>continue@b<!>