Fix contextual signature instantiation during type inference

Fixes #547.