semantic: Correctly handle TypeReferences in handleNull.