Fix error in type-directed search

This is a fix for issue https://github.com/idris-lang/Idris-dev/issues/1266.