Correctly handle parameter lists with shared types

Fixes #5.
Merge pull request #6 from josharian/fix-5

Correctly handle parameter lists with shared types