Files
mercury/tests/invalid/partial_implied_mode.m
Zoltan Somogyi fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00

48 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's difficult
% to make this program legal with the current mode checker without
% disallowing construction of partially instantiated terms.
%
% The reason partial_implied_mode2.m has to be a separate module
% is because unification procedures for local types have unique mode
% analysis run on them (although it's 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_mode2.
:- type quantitiesdico == map(quantity_key, physic_quantity).
:- pred search_quantitykey_1pin(pin, list(quantity_key),
quantitiesdico, quantity_key).
:- mode search_quantitykey_1pin(in, in, in, out) is det.
:- implementation.
:- import_module require.
search_quantitykey_1pin(PIN, [CUR_K | L], QTY_DICO, K) :-
(
map__lookup(QTY_DICO, CUR_K,
physic_quantity(PIN, _SYN, absol(_MEAS, _TBS)))
->
K = CUR_K
;
search_quantitykey_1pin(PIN, L, QTY_DICO, K)
).
search_quantitykey_1pin(_, [], _, _) :-
error("search_quantitykey_1pin : no such absolute quantity in the list").