[m-rev.] for review: type errors in foreign_procs

Julien Fischer jfischer at opturion.com
Wed Jan 27 14:18:58 AEDT 2021


On Wed, 27 Jan 2021, Zoltan Somogyi wrote:

> For review by anyone.

> Don't crash for type errors in foreign_procs.
> 
> Normally, foreign_procs are assumed to be type correct, because they
> have to be: a Mercury compiler cannot check foreign code. However,
> in one case, we can get type errors for foreign_procs. When a predicate has
> 
> - an existentially typed argument, and
> - two or more modes implemented by foreign procs.
> 
> The compiler has never been able to correctly handle more than one clause
> defining the type_info of an existentially typed argument. When those clauses
> were Mercury clauses, it generated an error; when those "clauses" were
> foreign_procs, it *tried* to generate an error, but the code that did that
> crashed the compiler.
> 
> compiler/typecheck_errors.m:
>     Fix the compiler crash, letting the error message to be generated.
> 
> tests/invalid/foreign_procs_exist_type.{m,err_exp}:
>     Add a test case for this fix.
> 
> tests/invalid/Mmakefile:
>     Enable the new test case.

That's fine.

Julien.


More information about the reviews mailing list