Fix types of `system` etc for new keyword arguments.

This requires extending the ->optkey type constructor to support rest
arguments, and fixing the keyword function type generation code.

Testing is still limited because there's no parsing for such types.
That will be handled in a later commit.