-
-
Save kaiser185/5462fc137b7f05ac2e079e247a86f5f9 to your computer and use it in GitHub Desktop.
Type system bug with debug mode compilation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(( | |
logtalk_load([meta(loader), types(loader), debugger(loader)], [debug(on)]), | |
logtalk_load([simpletypes, parametric], [debug(on)]) | |
)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- object(t1(_ListOfT2s_, _SomeId_)). | |
:- end_object. | |
:- object(t2(_SomeParameter_)). | |
:- end_object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- category(simpletypes). | |
:- multifile(type::type/1). | |
type::type(t1). | |
type::type(t2). | |
:- multifile(type::check/2). | |
type::check(t1, Term) :- | |
check_t1(Term). | |
type::check(t2, Term) :- | |
check_t2(Term). | |
check_t1(Term) :- | |
Term = t1(ListOfT2s, Id), | |
type::check(atomic, Id), | |
type::check( | |
property(non_empty_list(object), [T2s]>>( | |
meta::map([T2]>>( | |
type::check(t2, T2) | |
), T2s) | |
) | |
), ListOfT2s). | |
check_t2(Term) :- | |
Term = t2(Param), | |
type::check(atomic, Param). | |
:- end_category. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how to reproduce the bug
If we change the loader to (by commenting out the the debug(on) options of the logtalk_load/2 predicate):
The query works as expected:
Note that in this case we use no SWI-Prolog specific features like dicts.