[m-rev.] for review: improve error reporting for more foreign language interface pragmas

Julien Fischer jfischer at opturion.com
Wed May 25 15:00:38 AEST 2016


Hi Zoltan,

On Wed, 25 May 2016, Zoltan Somogyi wrote:

>> diff --git a/tests/invalid/bad_foreign_export.err_exp b/tests/invalid/bad_foreign_export.err_exp
>> index e69de29..4e746ae 100644
>> --- a/tests/invalid/bad_foreign_export.err_exp
>> +++ b/tests/invalid/bad_foreign_export.err_exp
>> @@ -0,0 +1,14 @@
>> +bad_foreign_export.m:020: Error: wrong number of arguments in
>> +bad_foreign_export.m:020:   `:- pragma foreign_export' declaration.
>> +bad_foreign_export.m:024: In `:- pragma foreign_export' declaration: error:
>> +bad_foreign_export.m:024:   atom expected at 12345.
>> +bad_foreign_export.m:028: In `:- pragma foreign_export' declaration: error:
>> +bad_foreign_export.m:028:   string expected at `12345'.
>> +bad_foreign_export.m:032: Error: invalid foreign language `"InvalidLanguage"'
>> +bad_foreign_export.m:032:   in `:- pragma foreign_export' declaration.
>> +bad_foreign_export.m:037: Error: invalid foreign language `"InvalidLanguage"'
>> +bad_foreign_export.m:037:   in `:- pragma foreign_export' declaration.
>> +bad_foreign_export.m:038: In `:- pragma foreign_export' declaration: error:
>> +bad_foreign_export.m:038:   atom expected at 1234.
>> +bad_foreign_export.m:039: In `:- pragma foreign_export' declaration: error:
>> +bad_foreign_export.m:039:   string expected at `5678'.
>> diff --git a/tests/invalid/bad_foreign_export.m b/tests/invalid/bad_foreign_export.m
>> index e69de29..a693b1a 100644
>>
>
> Instead of saying just “wrong number of arguments”, we should say something
> like “wrong number of arguments. There should be three: an xxx, a yyy and a zzz”,
> or give the same info in the form of a template.

That was one of the things I was referring to when I said the content of
the error messages could be improved.  I'll look at this separately as
this issue exists for pretty much every pragma.

> Also, instead of just saying e.g. “string expected”, we should say something
> like “expected a string that is the foreign-language name of the exported function”.

I've changed it to:

bad_foreign_export.m:039: In `:- pragma foreign_export' declaration: error:
bad_foreign_export.m:039:   expected a string that is the foreign language name

> And it would be nice if error terms such as 12345 were used just once in each
> test case, since that would make it easier to check the error message against
> the error without counting line numbers (when you are outside an editor) :-)

Ok, I'll change it to make them distinct.

Julien.


More information about the reviews mailing list