#NEWLINE# def sort_infer( term ) : #NEWLINE# #INDENT# res = concretize_sorts ( term ) #NEWLINE# for x in chain ( lu . used_variables ( res ) , lu . used_constants ( term ) ) : #NEWLINE# #INDENT# if ( lg . contains_topsort ( x . sort ) or lg . is_polymorphic ( x . sort ) ) : #NEWLINE# #INDENT# raise IvyError ( None , 'cannot infer sort of {}' . format ( x ) ) #NEWLINE# #UNINDENT# #UNINDENT# return res