Test to verify that each variable reference is associated with the inner most scoped variable with that name, except where name qualified. Applies most easily to local variables. The same test could be used for function references, actually all references.
Make sure that declarations appear before variable references.