Files
mercury/tests/valid/simplify_bug2.m
Julien Fischer a4519ed079 Move the all-solutions predicates from the library module std_util into their
Estimated hours taken: 4
Branches: main

Move the all-solutions predicates from the library module std_util into their
own module, solutions.

Move semidet_fail, semidet_succeed, cc_multi_equal and dynamic cast from
std_util.m into builtin.m.

Add some more utility functions for performing determinism or purity casts.
(The later are primarily intended for use by solver implementors.)

library/std_util.m:
	Move the all-solutions predicates into their own module, solutions.m.
	For now there are (obsolete) forwarding predicates from this module to
	the new one.  The forwarding predicates will be included in the
	upcoming 0.13 release and then removed in later versions.

	Move semidet_succeed, semidet_fail, cc_multi_equal and dynamic_cast
	to builtin.m

library/solutions.m:
	New file.  This is the new home for the all-solutions predicates.
	This is pretty much cut and pasted from std_util (with module
	qualifiers updated accordingly).  I've rearranged the code in a more
	top-down fashion as per our current coding standard.

library/builtin.m:
	Move semidet_fail/0, semidet_succeed/0, cc_multi_equal/2 and
	dynamic_cast/2 to this module.

	Add semidet_true/0 and semidet_false/0 as synonyms for semidet_fail/0
	and semidet_succeed/0.

	Add impure_true/0 and semipure_true/0.  These are useful for performing
	purity casts, e.g. in solver implementations.

library/library.m:
	Add the new module.

NEWS:
	Announce the changes.

library/*.m:
	Update to conform to the above.

compiler/const_prop.m:
	Update evaluate_semidet_call/5 with the new module name for
	dynamic_cast.

compiler/*.m:
	Module qualify calls to solutions to either disambiguate them from the
	versions in std_util (where they weren't module qualified) or change
	the module qualifier where they were (to avoid warnings about calls to
	the now deprecated versions).

tests/debugger/declarative/solutions.*:
	Rename this module as the name conflicts with the new library module.

tests/debugger/declarative/solns.*:
	Renamed version of above (with updated expected output).

tests/debugger/declarative/Mmakefile:
	Handle the renamed version of the solutions test.

tests/debugger/all_solutions.m:
tests/debugger/declarative/args.m:
tests/debugger/declarative/library_forwarding.m:
tests/hard_coded/constant_prop_2.m:
tests/invalid/multisoln_func.m:
tests/invalid/one_member.m:
tests/invalid/promise_equivalent_claueses.m:
tests/valid/simplify_bug2.m:
tests/valid/solv.m:
	Update to conform to the above changes.

sample/solutions/*.m:
	Update to conform to the above changes.
2006-03-24 04:40:59 +00:00

41 lines
985 B
Mathematica

:- module simplify_bug2.
:- interface.
:- type type_info ---> type_info(c_pointer).
:- type du_functor_descriptor ---> du_functor_descriptor(c_pointer).
:- pred get_type_and_extra_args(type_info::in, P::in,
type_info::out) is det.
:- implementation.
:- import_module require.
get_type_and_extra_args(TypeInfoParams, PseudoTypeInfo, ArgTypeInfo) :-
(
typeinfo_is_variable(PseudoTypeInfo, VarNum)
->
get_type_info_for_var(TypeInfoParams,
VarNum, ExpandedTypeInfo),
( typeinfo_is_variable(ExpandedTypeInfo, _) ->
error("get_type_and_extra_args: unbound type variable")
;
ArgTypeInfo = ExpandedTypeInfo
)
;
error("get_type_and_extra_args")
).
:- pred get_type_info_for_var(type_info::in, int::in, type_info::out) is det.
:- pragma no_inline(get_type_info_for_var/3).
get_type_info_for_var(X, _, X).
:- pred typeinfo_is_variable(T::in, int::out) is semidet.
:- pragma no_inline(typeinfo_is_variable/2).
typeinfo_is_variable(_, 42) :-
semidet_succeed.