Refinement of a typed WAM extension by polymorphic order-sorted types