Estimated hours taken: 10
Branches: main
Fix semidet C# code to use SUCCESS_INDICATOR.
Represent mlds__native_bool_type as bool, not int32.
In the library, fix incorrect uses of MC++ to implement functions -- these
weren't being caught because they returned int32, and we assumed
this was a semidet return value, not an actual integer.
These incorrect uses were all buggy -- functions don't work in MC++.
The compiler is now catches cases where functions returning int are
implemented in MC++ -- but it won't catch cases where
IL's bool type is returned, but that should not be a such a problem.
compiler/ilasm.m:
Handle the output of boolean integer constants.
compiler/ml_code_gen.m:
Add SUCCESS_INDICATOR to the locals of the MLDS for semidet C# code,
copy SUCCESS_INDICATOR into succeeded after the execution of the
user's code.
compiler/mlds_to_csharp.m:
Implement assignments (so we can copy SUCCESS_INDICATOR to
succeeded).
compiler/mlds_to_il.m:
Copy return values into SUCCESS_INDICATOR for forwarded
predicates (it will then be copied into succeeded).
This all gets optimized away in the generated IL anyway.
Represent native_bool_type as bool, not int32.
Check for MC++ functions returning bool (not int32).
Output true and false as boolean constants for 1 and 0.
compiler/mlds_to_mcpp.m:
Map bool to MR_Bool, not MR_Integer.
library/int.m:
Implement much of the code in Mercury rather than C# or MC++.
The more efficient C bindings remain, but for other backends we
fall back on the Mercury bindings.
library/io.m:
Implement io__get_stream_id as a pred in MC++.
It is easier to keep this as MC++ at the moment as that is what
the rest of the io.m code is implemented in (including the
Mercury stream data structure).
library/std_util.m:
Add some missing assignments to SUCCESS_INDICATOR.