[m-rev.] for review: module_add_type_defn

Julien Fischer jfischer at opturion.com
Thu Jun 29 01:28:42 AEST 2017


Hi Zoltan,

On Thu, 29 Jun 2017, Zoltan Somogyi wrote:

> On Wed, 28 Jun 2017 22:32:28 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
>>> However, the existing implementation says yes; it allows having both a
>>> solver type and a foreign type definition for the same name.
>>
>> My guess would be that the code for adding types was never updated
>> properly when the current version of solver types was added.
>
> That is my guess as well.
>
> The attached diff implements what we agreed on. I am committing it;
> I would appreciate it if you would look over the diffs to NEWS and to
> tests/valid/solver_type_bug.m.

They look fine.

...

> diff --git a/tests/invalid/abstract_solver_type.err_exp b/tests/invalid/abstract_solver_type.err_exp
> index e69de29..8eb2223 100644
> --- a/tests/invalid/abstract_solver_type.err_exp
> +++ b/tests/invalid/abstract_solver_type.err_exp
> @@ -0,0 +1,9 @@
> +abstract_solver_type.m:015: Error: this definition of type `foo1'/0 is not a
> +abstract_solver_type.m:015:   solver type, but its previous declaration is.
> +abstract_solver_type.m:009:   The previous declaration is here.
> +abstract_solver_type.m:017: Error: this definition of type `foo2'/0 is not a
> +abstract_solver_type.m:017:   solver type, but its previous declaration is.
> +abstract_solver_type.m:010:   The previous declaration is here.
> +abstract_solver_type.m:021: Error: this definition of type `foo3'/0 is not a
> +abstract_solver_type.m:021:   solver type, but its previous declaration is.
> +abstract_solver_type.m:011:   The previous declaration is here.

The only slight quibble I have here is with the use of the word
"previous".  It is possible that the definition may precede the
declaration in the source code order.  I will grant that it's very
unlikely (and not particularly advisable) but in principle nothing in
Mercury prevents that from being done.

Julien.


More information about the reviews mailing list