Strange discrepency between local and non-local scope

The scope of the name is decided statically. The name is resolved, within that chosen scope, at runtime.

Just as explained in your previous question.

Also relevant:

(especially see my answer on this one ^)