Compiler refactoring for the new type system