mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
Estimated hours taken: 0.75 Fix a bug where having a type named `,'/2 caused an error in the generated C code, because the type name was not being mangled. compiler/llds_out.m: Mangle type names for base_type_infos. tests/valid/name_mangling.m: tests/valid/Mmake: tests/hard_coded/name_mangling.m: tests/hard_coded/Mmake: Add some more tests of name mangling to `name_mangling.m', and move it from the `valid' to the `hard_coded' directory, since it is now a complete program that produces output.
42 lines
868 B
Mathematica
42 lines
868 B
Mathematica
:- module name_mangling.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- type 'a strange type name'
|
|
---> 'a strange functor'
|
|
; 'another strange functor'.
|
|
|
|
:- type 'another wierd type' == int.
|
|
|
|
:- type (A,B) ---> (A,B).
|
|
:- inst (A,B) ---> (A,B).
|
|
:- func mk_pair(A,B) = (A,B).
|
|
|
|
:- pred 'this is a test' is det.
|
|
|
|
:- pred 'this is another test'('a strange type name'::out) is multi.
|
|
|
|
:- pred 'yet another test'('another wierd type'::out) is det.
|
|
|
|
:- implementation.
|
|
:- import_module std_util.
|
|
|
|
mk_pair(A,B) = (A,B).
|
|
|
|
'this is a test'.
|
|
|
|
'this is another test'('a strange functor').
|
|
'this is another test'('another strange functor').
|
|
|
|
'yet another test'(42).
|
|
|
|
main -->
|
|
{ 'this is a test' },
|
|
write('a strange functor'), nl,
|
|
write('another strange functor'), nl,
|
|
{ solutions('this is another test', List) },
|
|
write(List), nl.
|
|
|