Implementation for calculating the stable types in the source