Refactor formal argument lists and improve error reporting (#13009).

Change-Id: Iaa80787e80d05f9d0a5c4ae5e92a65582482382f