Scoping edge case fix

The previous implementation would report assignments to constant references for variables defined in
a closure if the englobing scope also had a reference of the same name.