fix type reference resolution and highlighting