Fix case where a type error would be generated instead of the expected instantiation error when passing a non-ground file argument to the compilation and loading predicates