Some cases in linkReferencesToTypes: It always hits one or both of the conditionals, so moving the mutation outside is a slight optimization and also reduces noise.