Backport of semantic type support from 0.6