Add type_compat script
Merge branch 'mainline' into HEAD