Can you please check to verify that definedSorts is computed by means of processing every production in the definition? Otherwise this might not work as expected.