Define test to demonstrate ast awkwardness.
Add type annotations for references.
Clean up code for handling type annotations in local references.