ligasgr / intellij-xquery

Plugin to support XQuery in Intellij Idea
Apache License 2.0
35 stars 23 forks source link

Shadowed variable declarations get marked as unused. #136

Closed rhdunn closed 8 years ago

rhdunn commented 8 years ago

Given:

let $foo := //foo
let $_ := for $foo in $foo return $foo/bar

The first instance of $foo gets marked as unused, when it should not. This applies more generally as well.

ligasgr commented 8 years ago

I understand that in this not too realistic but still possible scenario the first $foo is used as the collection in the for? (that's what all language implementations seem to think as well) I'll try to have a look on how to improve the usage verification in such cases.

ligasgr commented 8 years ago

Hi,

changes prepared should fix this issue and #140. I'll prepare more comprehensive suite of tests for those cases later. I've only fixed it for now for "for" and "let" bindings. If you can please try to find any additional scenarios with sliding/tumbling windows, group by, etc that would still require a fix and raise them as separate issue.