#7065 'Scope too broad' inspection bug?

A weird one, this. When I enter the exact test code below (just a simplified example), I get the declaration of variable 'index' highlighted with a "Scope of variable 'index' is too broad..." inspection tooltip. If I Alt-Enter and select "Narrow scope of 'index'", it incorrectly moves the index declaration past the end of the 'for' loop.

This leaves the index = i; line inside the loop as an unresolved symbol error...

When I was editing the original code down to the example above, I found the 'Scope too broad...' inspection hint would sometimes disappear depending on declarations, comments or blank lines in front of, or after, the code in question. However, this wasn't consistent or repeatable.

Please sign in to leave a comment.