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:
+4
-4
@@ -24,17 +24,17 @@ inline fun foo(bar1: (String.() -> Int) -> Int, bar2: (()->Int) -> Int) {
|
||||
}
|
||||
|
||||
inline fun foo2(bar1: (String.() -> Int) -> Int) {
|
||||
l1@ <!USAGE_IS_NOT_INLINABLE!>bar1<!>
|
||||
<!REDUNDANT_LABEL_WARNING!>l1@<!> <!USAGE_IS_NOT_INLINABLE!>bar1<!>
|
||||
|
||||
l2@ bar1 {
|
||||
<!REDUNDANT_LABEL_WARNING!>l2@<!> bar1 {
|
||||
11
|
||||
}
|
||||
|
||||
(l3@ bar1) {
|
||||
(<!REDUNDANT_LABEL_WARNING!>l3@<!> bar1) {
|
||||
11
|
||||
}
|
||||
|
||||
(l5@ (l4@ bar1)) {
|
||||
(<!REDUNDANT_LABEL_WARNING!>l5@<!> (<!REDUNDANT_LABEL_WARNING!>l4@<!> bar1)) {
|
||||
11
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,6 @@ inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) {
|
||||
}
|
||||
|
||||
inline fun propagation(s: (p: Int) -> Unit) {
|
||||
inlineFunWithInvoke((label@ s))
|
||||
inlineFunWithInvoke((label2@ label@ s))
|
||||
inlineFunWithInvoke((<!REDUNDANT_LABEL_WARNING!>label@<!> s))
|
||||
inlineFunWithInvoke((<!REDUNDANT_LABEL_WARNING!>label2@<!> <!REDUNDANT_LABEL_WARNING!>label@<!> s))
|
||||
}
|
||||
Reference in New Issue
Block a user