Avoid a compiler abort when people put a period in the middle of a clause.

The abort was caused by the fact that when the parser found an item that
looks like a fact for an undeclared predicate, such as the predicate ','/,
it created a hlds_pred filled with a clause_info in which terms that the
user intended to be goals are instead taken to be terms. Any reference
to predicates in those terms are taken by purity-checking to be higher order
references, which need a mode declaration. If the reference is to a predicate
(such as ,/2) whose declaration is implicit, that mode declaration will be
missing.

The fix has two parts. First, do not generate an abort in purity checking
when finding the mode declaration of a predicate or function in (what seems to
be) a higher order term is missing. Second, do not generate implicit
declarations for ,/2, since this is NEVER what the user wants.

A third part of this diff is an improvement in the contexts we record
for terms, for better error messages. I noticed the need for this when
looking at the compiler's output for the new cases.

compiler/post_typecheck.m:
   When finding an apparent reference to a predicate or function with
   no mode declarations, do not abort; instead, report an error.

compiler/purity.m:
   Record the error reported by post_typecheck.m.

compiler/add_clause.m:
   If we see a clause for `,'/2, do NOT treat it as implicitly defining
   a ,/2 predicate. Instead, generate a situation-specific error message that
   mentions the usual cause of the error.

compiler/add_pred.m:
   Clean up the predicates that add the implicit predicate declarations
   by making them both update module_infos, and by putting their arguments
   into a consistent order.

compiler/make_hlds_passes.m:
   Do likewise for a couple of predicates here.

compiler/add_pragma.m:
   Conform to the change to add_pred.m.

compiler/superhomogeneous.m:
   When expanding a term such as

      line 1: p(a,
      line 2: p(b,
      line 3: c))

   associate line 2 with the unification of a fresh variable with b,
   and line 3 with the unification of a fresh variable with c. We used
   to use the context of the top level term, which in this case is line 1,
   instead.

   This makes the compiler generate better (less misleading) output for the
   ref_to_implicit_pred.m test case below, as well as in many other cases.

compiler/state_var.m:
   When replacing !.X or !:X with a fresh variable term, copy the context
   of the original functor term to the new variable term. Before the change
   to superhomogeneous.m, this wasn't needed since the context of that term
   was ignored, but now we use it.

tests/invalid/ref_to_implicit_pred.{m,err_exp}:
   New test case to test the first part of the fix.

tests/invalid/ref_to_implicit_comma.{m,err_exp}:
   New test case to test the second part of the fix.

tests/invalid/Mmakefile:
   Enable both new test cases.

tests/hard_coded/impl_def_literal.{m,exp}:
   Update this expected output for the more accurate contexts we now
   generate, and update the comment in the source code accordingly.

tests/invalid/ambiguous_overloading_error.exp:
tests/invalid/max_error_line_width.err_exp:
tests/invalid/transitive_import_class.err_exp:
tests/warnings/ambiguous_overloading.exp:
   Update these expected outputs for the more accurate contexts we now
   generate.
Merge remote-tracking branch 'upstream/master'