kyledewey / typed-prolog

A basic type system on top of Prolog, along with higher-order clauses. Translates to normal Prolog.
27 stars 1 forks source link

Silent failure on duplicate clausedefs #13

Closed maemre closed 8 years ago

maemre commented 8 years ago

If there are duplicate clausedefs in a module for same clause, typed prolog fails silently instead of giving an error.

Both of the two examples fail silently (they don't get compiled but no error is printed, the compilation predicate in compiler fails silently), so the error happens both when clausedefs are completely identical and when only the predicate names are same:

module(test, [], []).

clausedef(test1, [], [int, int, int]).
clausedef(test1, [], [int, int, int]).
test1(X, Y, Z) :-
    X is Y.
module(test, [], []).

clausedef(test1, [], [int, int, int]).
clausedef(test1, [], [int, int, atom]).
test1(X, Y, Z) :-
    X is Y.
kyledewey commented 8 years ago

Out of curiosity, I tried the same thing for types, which revealed another problem, reported in issue #15.

kyledewey commented 8 years ago

Fixed with a series of commits, the last of which was 236260b0f997a0f9341c6a2b6f2db646900f629c.