Check kw functions with optional arguments better

In particular, allow the optional kws to be left out in the
expected type (a function type with fewer optional kws is
a supertype).

Closes PR 14583
Give more information for kw errors in TR

Tells the user which missing keywords were mandatory and
which were optional (which is useful if, e.g., the expected type
says mandatory but the function had it optional).