[m-rev.] for post-commit review: fix tests/invalid failures, part 1

Julien Fischer jfischer at opturion.com
Mon Sep 15 12:37:35 AEST 2025


On Sun, 14 Sept 2025 at 10:12, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Fix some tests/invalid failures.

...

> diff --git a/tests/invalid/exported_foreign_enum.m b/tests/invalid/exported_foreign_enum.m
> index 66403a409..58972e606 100644
> --- a/tests/invalid/exported_foreign_enum.m
> +++ b/tests/invalid/exported_foreign_enum.m
> @@ -9,6 +9,18 @@
>
>  :- pred main(io::di, io::uo) is det.
>
> +:- type t1
> +    --->    f11
> +    ;       f12
> +    ;       f13(int).
> +
> +:- type t2
> +    --->    f21
> +    ;       f22
> +    ;       f23.
> +
> +%---------------------------------------------------------------------------%
> +
>  :- implementation.
>
>  main(!IO) :-
> @@ -30,7 +42,16 @@ main(!IO) :-
>          SUCCESS_INDICATOR = MR_FALSE;
>      }
>  ").
> -
> +:- pragma foreign_proc("Java",
> +    test(X::in),
> +    [will_not_call_mercury, promise_pure],
> +"
> +    if (X == FOO_bar) {
> +        SUCCESS_INDICATOR = true;
> +    } else {
> +        SUCCESS_INDICATOR = false;
> +    }
> +").
>  :- pragma foreign_proc("C#",
>      test(X::in),
>      [will_not_call_mercury, promise_pure],
> @@ -49,49 +70,61 @@ main(!IO) :-
>      ;       bar
>      ;       baz.
>
> -:- pragma foreign_export_enum("C", foo/0, [prefix("FOO_")]).
> +:- pragma foreign_export_enum("C",    foo/0, [prefix("FOO_")]).
> +:- pragma foreign_export_enum("Java", foo/0, [prefix("FOO_")]).
> +:- pragma foreign_export_enum("C#",   foo/0, [prefix("FOO_")]).
>
>  :- pragma foreign_enum("C", foo/0, [
>      foo - "400",
>      bar - "500",
>      baz - "600"
>  ]).
> -
> -% :- pragma reserve_tag(foo/0). This pragma is not supported anymore.
> +:- pragma foreign_enum("Java", foo/0, [
> +    foo - "400",
> +    bar - "500",
> +    baz - "600"

foreign_enum pragmas are *not* supported by the Java backend.
This test "works" since we currently only seem to "deal" with the
fact that they are not supported in the MLDS->Java code generator

The diff is fine otherwise.

Julien.


More information about the reviews mailing list