Better deduction of locals/globals in type dependencies