Files
mercury/tests/invalid/partial_implied_mode.m
Zoltan Somogyi f345d20e33 Rename X's aux modules as X_helper_N in invalid.
tests/invalid/*.m:
    Rename modules as mentioned above.

    In two cases where the main module name is a Mercury keyword (to the
    extent that Mercury has keywords), add a "test_" prefix to the
    module name.

    Reorganize the ho_default_func_2 test case. The original code
    of this test had three modules, a parent and two children,
    with the module being tested being one of the *child* modules
    (ho_default_func_2.sub). This does not work; the .log file
    from the successful execution of this test case showed that
    there was no actual compilation involved; the test stopped
    after invoking "mmc --generate-dependencies" on that child module.
    The new version of this test makes that child module the main module,
    and moves the relevant parts of the other two original modules
    into a single new child module.

    Rename ii_parent to instance_pc (pc being short for parent-child).
    This test case still has the child module listed as the target
    in Mmakefile, so it still does not progress past generating its
    dependencies.

    Rename the imported_mode test case as bad_exported_mode,
    because this is what it was testing.

    exported_mode.m was used both as the main module of a test,
    and as a helper module in the imported_mode test (now renamed
    to bad_exported_mode). Make a copy of it as a helper module
    for bad_exported_mode.

    Update all references to the moved modules.

    General updates to programming style, such as

    - replacing DCG notation with state var notation
    - adding lines around vim modelines
    - fixing indentation
    - fixing grammar errors in comments

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
    Update all references to the moved modules and/or moved lines.
2023-06-16 20:18:36 +02:00

47 lines
1.6 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a test for partially implied modes where the overbound
% term is partially instantiated. This really shouldn't be an error,
% and won't be with the alias tracking mode checker. It is difficult
% to make this program legal with the current mode checker without
% disallowing construction of partially instantiated terms.
%
% The reason partial_implied_mode_helper_1.m has to be a separate module
% is because unification procedures for local types have unique mode
% analysis run on them (although it is really not necessary).
% For local types, the code generator abort did not happen
% because unique_modes reported a mode error.
%
% Mercury rotd-1999-05-08 aborted during code generation on this test case.
:- module partial_implied_mode.
:- interface.
:- import_module list.
:- import_module map.
:- import_module partial_implied_mode_helper_1.
:- type quantitiesdico == map(quantity_key, physic_quantity).
:- pred search_quantitykey_1pin(pin::in, list(quantity_key)::in,
quantitiesdico::in, quantity_key::out) is det.
:- implementation.
:- import_module require.
search_quantitykey_1pin(PIN, [CUR_K | L], QTY_DICO, K) :-
( if
map.lookup(QTY_DICO, CUR_K,
physic_quantity(PIN, _SYN, absol(_MEAS, _TBS)))
then
K = CUR_K
else
search_quantitykey_1pin(PIN, L, QTY_DICO, K)
).
search_quantitykey_1pin(_, [], _, _) :-
error("search_quantitykey_1pin : no such absolute quantity in the list").