Correctly handle parameter lists with shared types

Fixes #5.