Don't issue W088 if identifier is declared in a higher scope

Closes #1016
Closes #1860