Files
mercury/tests/invalid/errors2.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

90 lines
1.9 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module errors2.
%---------------------------------------------------------------------------%
:- pred bind_type_param(TypeParam::input, TypeParam2::output).
bind_type_param(Argument) :-
Argument = 0.
%---------------------------------------------------------------------------%
% currently the compiler just gives a warning for this test case
:- pred unresolved_polymorphism.
unresolved_polymorphism :-
bind_type_param(Arg, Arg).
%---------------------------------------------------------------------------%
:- pred produce_string(string).
:- pred expect_int(int).
:- pred type_error.
type_error :-
produce_string(X),
expect_int(X).
:- pred type_error_2.
type_error_2 :-
produce_string(X),
expect_int(Y),
X = Y.
:- pred type_error_3.
type_error_3 :-
X = Y,
produce_string(X),
expect_int(Y).
:- type foo_type ---> foo_functor(int, character, string).
:- type bar_1_type ---> bar_functor(int, character, string).
:- type bar_2_type ---> bar_functor(character, int, string).
:- pred type_error_4.
type_error_4 :-
Y = 0,
X = foo_functor(Y, 'x', 1.0).
:- pred type_error_5.
:- type foo ---> a ; b ; c.
type_error_5 :-
Y = 'a',
X = foo_functor(0, Y, 1.0).
:- pred type_error_6.
type_error_6 :-
Y = 'a',
X = bar_functor(0, Y, 1.0).
:- pred type_error_7.
type_error_7 :-
Y = 'a',
Z = bar_functor(A, B, C),
expect_int(C).
:- use_module list, string.
:- pred type_error_8.
type_error_8 :-
from_char_list([], Str),
string__from_char_list(list.[], Str).
:- pred type_error_9.
type_error_9 :-
X = {1, "2", '3'},
Y = {"1", '2', 3},
X = Y.
%---------------------------------------------------------------------------%