mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 18:33:58 +00:00
This fixes Mantis bug #485. compiler/check_parse_tree_type_defns.m: Generalize the representation of du types in checked type definitions to give special representation to dummy types, as well as enum types. Allow foreign enum definitions for types whose du definitions are dummy, as well as those whose du definitions are enum. compiler/prog_type.m: Have the predicate that tests whether a du type is an enum type to return the number of function symbols as well as the number of bits needed to represent them. This is the most direct differentiator between dummy types and enum types. compiler/comp_unit_interface.m: Conform to the change in prog_type.m. tests/valid/bug485.m: A regression test for the bug. tests/valid/Mmakefile: Enable the new test case.
20 lines
499 B
Mathematica
20 lines
499 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module bug485.
|
|
:- interface.
|
|
|
|
:- type dt
|
|
---> dummy_value.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- pragma foreign_enum("C", dt/0, [
|
|
dummy_value - "42"
|
|
]).
|
|
|
|
%---------------------------------------------------------------------------%
|