Infer class assignments in outer context