Fix type inference of extension attributes (make sure they are defined before referenced)