The code for value declarations and type annotations was duplicated between top-level and nested occurrences. This PR uses the same element class for both. It also fixes a bug where inner type annotations weren't reference elements, so wouldn't get picked up by rename etc.