cmd/gc: ensure unique parameter and result names in function types

In addition to fixing the bug, the check is now linear instead of quadratic.

Fixes issue 4469.

R=ken2
CC=golang-dev
https://codereview.appspot.com/7773047