Only call doExtendTraits if we are not in SEMANTIC_ANALYSIS phase

Pending investigation.