Flattening of types, started constant propagation and type checking