handle abstract casting during typing