Fix infinite loop in CanBeValInspection
Obviously there should be 'return' instead of 'continue' Otherwise the loop will not end #KT-11891 Fixed
This commit is contained in:
@@ -98,7 +98,7 @@ class CanBeValInspection : AbstractKotlinInspection() {
|
|||||||
var instruction = from
|
var instruction = from
|
||||||
while (instruction is InstructionWithNext) {
|
while (instruction is InstructionWithNext) {
|
||||||
val next = instruction.next ?: return false
|
val next = instruction.next ?: return false
|
||||||
if (next in visited) continue
|
if (next in visited) return false
|
||||||
if (next in targets) return true
|
if (next in targets) return true
|
||||||
visited.add(next)
|
visited.add(next)
|
||||||
instruction = next
|
instruction = next
|
||||||
|
|||||||
@@ -61,4 +61,13 @@
|
|||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Local 'var' can be declared as 'val'</problem_class>
|
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Local 'var' can be declared as 'val'</problem_class>
|
||||||
<description>Can be declared as 'val'</description>
|
<description>Can be declared as 'val'</description>
|
||||||
</problem>
|
</problem>
|
||||||
|
|
||||||
|
<problem>
|
||||||
|
<file>kt11891.kt</file>
|
||||||
|
<line>2</line>
|
||||||
|
<module>light_idea_test_case</module>
|
||||||
|
<entry_point TYPE="file" FQNAME="kt11891.kt" />
|
||||||
|
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Local 'var' can be declared as 'val'</problem_class>
|
||||||
|
<description>Can be declared as 'val'</description>
|
||||||
|
</problem>
|
||||||
</problems>
|
</problems>
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
fun main(args: Array<String?>) {
|
||||||
|
var a: String?
|
||||||
|
|
||||||
|
if (args.size == 1) {
|
||||||
|
a = args[0]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
a = args.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a != null && a.equals("cde")) return
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user