From b2ebb02990155e9251c17355b4d7f8da15d5e8dc Mon Sep 17 00:00:00 2001 From: Julien Fischer Date: Sun, 5 Oct 2025 15:56:34 +1100 Subject: [PATCH] Fix a failing test case. The test case hard_coded/intermod_foreign_type is failing in the C# grades due to a missing foreign_type pragma. When originally added this test case had a foreign_type pragma for IL, but at some point that was deleted (presumably at the same time the IL backend was removed). This meant that for C# grades, the coord/0 type would default to its Mercury definition, which conflicts with the handwritten definition used by the C# foreign_procs. The fix is to add a C# foreign_type pragma. tests/hard_coded/intermod_foreign_type.m: tests/hard_coded/intermod_foreign_type_helper_1.m: Add a missing c# foreign_type pragma. Delete unused imports. --- tests/hard_coded/intermod_foreign_type.m | 5 +++-- tests/hard_coded/intermod_foreign_type_helper_1.m | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/hard_coded/intermod_foreign_type.m b/tests/hard_coded/intermod_foreign_type.m index d80b13949..c65de2590 100644 --- a/tests/hard_coded/intermod_foreign_type.m +++ b/tests/hard_coded/intermod_foreign_type.m @@ -3,17 +3,18 @@ %---------------------------------------------------------------------------% :- module intermod_foreign_type. - :- interface. :- import_module io. :- pred main(io::di, io::uo) is det. +%---------------------------------------------------------------------------% +%---------------------------------------------------------------------------% + :- implementation. :- import_module intermod_foreign_type_helper_1. -:- import_module std_util. main(!IO) :- C = new(4, 5), diff --git a/tests/hard_coded/intermod_foreign_type_helper_1.m b/tests/hard_coded/intermod_foreign_type_helper_1.m index 4e59b966c..665957430 100644 --- a/tests/hard_coded/intermod_foreign_type_helper_1.m +++ b/tests/hard_coded/intermod_foreign_type_helper_1.m @@ -17,8 +17,6 @@ :- implementation. -:- import_module std_util. - :- pragma foreign_decl("C#", " public class coord { public int x; @@ -51,7 +49,11 @@ public class coord { %---------------------------------------------------------------------------% -% Mercury implementation +% C# implementation. + +:- pragma foreign_type("C#", coord, "coord"). + +% Mercury implementation. :- type coord ---> coord(x :: int, y :: int).