We were previously using symbol nodes to represent <ref> types, but these do not have clean cloning semantics. This diff switches to use standard VariableNodes, and implements the necessary modifications to the type-checker to make this work. Added new test case.