Permalink
Browse files

Fix misspelling of `instantiation_error` in some compiler exceptions

  • Loading branch information...
pmoura committed Jan 9, 2019
1 parent a06b916 commit ac028266f24fc56ec663d1f5e8be2994f0d19b42
@@ -39,6 +39,9 @@ presence of anonymous variables in the predicate definition.
* FIXED: Enable message sending static binding optimization when the message
is an alias of a meta-predicate.

* FIXED: Misspelling of `instantiation_error` in some exceptions throw by the
compiler.

Prolog adapter and integration files
------------------------------------

@@ -77,6 +80,11 @@ Ports
* ADDED: Port of `metagol`, an inductive logic programming (ILP) system based
on meta-interpretive learning.

Tests
-----

* IMPROVED: Unit tests for the entity creation built-in predicates.

Examples
--------

@@ -1 +1 @@
3.23.0-b06
3.23.0-b07
@@ -3384,7 +3384,7 @@
% versions, 'rcN' for release candidates (with N being a natural number),
% and 'stable' for stable versions

'$lgt_version_data'(logtalk(3, 23, 0, b06)).
'$lgt_version_data'(logtalk(3, 23, 0, b07)).



@@ -8053,7 +8053,7 @@

'$lgt_compile_expanded_term'((-), Term, _) :-
% catch variables
throw(error(instantiantion_error, term_expansion(Term, _))).
throw(error(instantiation_error, term_expansion(Term, _))).

'$lgt_compile_expanded_term'(begin_of_file, _, _) :-
!.
@@ -8101,7 +8101,7 @@
assertz('$lgt_pp_prolog_term_'(ExpandedTerm, SourceData, Lines))
)
; var(ExpandedTerm) ->
throw(error(instantiantion_error, term_expansion(Term, {ExpandedTerm})))
throw(error(instantiation_error, term_expansion(Term, {ExpandedTerm})))
; throw(error(type_error(callable, Term), term_expansion(Term, {ExpandedTerm})))
).

@@ -8165,7 +8165,7 @@

'$lgt_compile_runtime_term'((-), _) :-
% catch variables
throw(error(instantiantion_error, term(_))).
throw(error(instantiation_error, term(_))).

'$lgt_compile_runtime_term'(begin_of_file, _) :-
!.
@@ -8179,7 +8179,7 @@
( callable(Term) ->
assertz('$lgt_pp_entity_term_'({Term}, nil, '-'(0,0)))
; var(Term) ->
throw(error(instantiantion_error, term({Term})))
throw(error(instantiation_error, term({Term})))
; throw(error(type_error(callable, Term), term({Term})))
).

@@ -8211,7 +8211,7 @@

'$lgt_compile_directive'((-), _) :-
% catch variables
throw(error(instantiantion_error, directive(_))).
throw(error(instantiation_error, directive(_))).

% conditional compilation directives

@@ -8638,17 +8638,16 @@
% '$lgt_compile_logtalk_directives'(+list(term), +compilation_context)
%
% compiles a list of Logtalk directives
%
% note that the clause order ensures that instantiation errors will be caught
% by the call to the '$lgt_compile_logtalk_directive'/2 predicate

'$lgt_compile_logtalk_directives'([Directive| Directives], Ctx) :-
% only the compilation context mode should be shared between different directives
'$lgt_comp_ctx_mode'(Ctx, Mode),
'$lgt_comp_ctx_mode'(NewCtx, Mode),
( '$lgt_logtalk_directive'(Directive) ->
'$lgt_compile_logtalk_directive'(Directive, NewCtx),
'$lgt_compile_logtalk_directives'(Directives, Ctx)
( var(Directive) ->
throw(instantiation_error)
; '$lgt_logtalk_directive'(Directive) ->
'$lgt_compile_logtalk_directive'(Directive, Ctx),
% only the compilation context mode should be shared between different directives
'$lgt_comp_ctx_mode'(Ctx, Mode),
'$lgt_comp_ctx_mode'(NewCtx, Mode),
'$lgt_compile_logtalk_directives'(Directives, NewCtx)
; functor(Directive, Functor, Arity),
throw(domain_error(directive, Functor/Arity))
).
@@ -16299,7 +16298,7 @@

'$lgt_inlining_candidate'(TBody, _) :-
'$lgt_pp_defines_predicate_'(_, _, _, TBody, compile(_), user),
% call to a local predicate
% call to a local user-defined predicate
!.


@@ -22,111 +22,131 @@
extends(lgtunit)).

:- info([
version is 1.4,
version is 1.5,
author is 'Paulo Moura',
date is 2018/03/27,
date is 2019/01/09,
comment is 'Unit tests for the create_category/4 built-in predicate.'
]).

throws(create_category_4_01, error(instantiation_error, logtalk(create_category(_, _, _, _), _))) :-
% delay the error to runtime
{create_category(_, _, _, _)}.

throws(create_category_4_02, error(type_error(category_identifier, 1), logtalk(create_category(1, [], [], []), _))) :-
throws(create_category_4_01, error(type_error(category_identifier, 1), logtalk(create_category(1, [], [], []), _))) :-
% delay the error to runtime
{create_category(1, [], [], [])}.

throws(create_category_4_03, error(permission_error(modify, protocol, monitoring), logtalk(create_category(monitoring, [], [], []), _))) :-
throws(create_category_4_02, error(permission_error(modify, protocol, monitoring), logtalk(create_category(monitoring, [], [], []), _))) :-
% delay the error to runtime
{create_category(monitoring, [], [], [])}.

throws(create_category_4_04, error(type_error(list, atom), logtalk(create_category(_, atom, [], []), _))) :-
throws(create_category_4_03, error(instantiation_error, logtalk(create_category(_, _, [], []), _))) :-
% delay the error to runtime
{create_category(_, _, [], [])}.

throws(create_category_4_04, error(instantiation_error, logtalk(create_category(_, [], _, []), _))) :-
% delay the error to runtime
{create_category(_, [], _, [])}.

throws(create_category_4_05, error(instantiation_error, logtalk(create_category(_, [], [], _), _))) :-
% delay the error to runtime
{create_category(_, [], [], _)}.

throws(create_category_4_06, error(instantiation_error, logtalk(create_category(_, [_], [], []), _))) :-
% delay the error to runtime
{create_category(_, [_], [], [])}.

throws(create_category_4_07, error(instantiation_error, logtalk(create_category(_, [], [_], []), _))) :-
% delay the error to runtime
{create_category(_, [], [_], [])}.

throws(create_category_4_08, error(instantiation_error, logtalk(create_category(_, [], [], [_]), _))) :-
% delay the error to runtime
{create_category(_, [], [], [_])}.

throws(create_category_4_09, error(type_error(list, atom), logtalk(create_category(_, atom, [], []), _))) :-
% delay the error to runtime
{create_category(_, atom, [], [])}.

throws(create_category_4_05, error(type_error(list, atom), logtalk(create_category(_, [], atom, []), _))) :-
throws(create_category_4_10, error(type_error(list, atom), logtalk(create_category(_, [], atom, []), _))) :-
% delay the error to runtime
{create_category(_, [], atom, [])}.

throws(create_category_4_06, error(type_error(list, atom), logtalk(create_category(_, [], [], atom), _))) :-
throws(create_category_4_11, error(type_error(list, atom), logtalk(create_category(_, [], [], atom), _))) :-
% delay the error to runtime
{create_category(_, [], [], atom)}.

throws(create_category_4_07, error(permission_error(modify, dynamic_predicate, foo/1), logtalk(create_category(_, [], [dynamic(foo/1), synchronized(foo/1)], []), _))) :-
throws(create_category_4_12, error(permission_error(modify, dynamic_predicate, foo/1), logtalk(create_category(_, [], [dynamic(foo/1), synchronized(foo/1)], []), _))) :-
% delay the error to runtime
{create_category(_, [], [dynamic(foo/1), synchronized(foo/1)], [])}.

throws(create_category_4_08, error(permission_error(modify, synchronized_predicate, foo/1), logtalk(create_category(_, [], [synchronized(foo/1), dynamic(foo/1)], []), _))) :-
throws(create_category_4_13, error(permission_error(modify, synchronized_predicate, foo/1), logtalk(create_category(_, [], [synchronized(foo/1), dynamic(foo/1)], []), _))) :-
% delay the error to runtime
{create_category(_, [], [synchronized(foo/1), dynamic(foo/1)], [])}.

throws(create_category_4_09, error(domain_error({1}, 2), logtalk(create_category(_, [], [public(map/2), meta_predicate(map(1,*))], [(map(Cl,El) :- call(Cl,El,_))]), _))) :-
throws(create_category_4_14, error(domain_error({1}, 2), logtalk(create_category(_, [], [public(map/2), meta_predicate(map(1,*))], [(map(Cl,El) :- call(Cl,El,_))]), _))) :-
% delay the error to runtime
{create_category(_, [], [public(map/2), meta_predicate(map(1,*))], [(map(Cl,El) :- call(Cl,El,_))])}.

throws(create_category_4_10, error(permission_error(repeat, entity_relation, implements/1), logtalk(create_category(_, [implements(protocol1), implements(protocol2)], [], []), _))) :-
throws(create_category_4_15, error(permission_error(repeat, entity_relation, implements/1), logtalk(create_category(_, [implements(protocol1), implements(protocol2)], [], []), _))) :-
% delay the error to runtime
{create_category(_, [implements(protocol1), implements(protocol2)], [], [])}.

throws(create_category_4_11, error(permission_error(repeat, entity_relation, extends/1), logtalk(create_category(_, [extends(category1), extends(category2)], [], []), _))) :-
throws(create_category_4_16, error(permission_error(repeat, entity_relation, extends/1), logtalk(create_category(_, [extends(category1), extends(category2)], [], []), _))) :-
% delay the error to runtime
{create_category(_, [extends(category1), extends(category2)], [], [])}.

throws(create_category_4_12, error(permission_error(repeat, entity_relation, complements/1), logtalk(create_category(_, [complements(object1), complements(object2)], [], []), _))) :-
throws(create_category_4_17, error(permission_error(repeat, entity_relation, complements/1), logtalk(create_category(_, [complements(object1), complements(object2)], [], []), _))) :-
% delay the error to runtime
{create_category(_, [complements(object1), complements(object2)], [], [])}.

succeeds(create_category_4_13) :-
succeeds(create_category_4_18) :-
create_object(Category, [], [], []),
atom(Category).

succeeds(create_category_4_14) :-
succeeds(create_category_4_19) :-
create_category(create_category_4_test_category, [], [], []),
abolish_category(create_category_4_test_category).

succeeds(create_category_4_15) :-
succeeds(create_category_4_20) :-
create_category(Category, [], [], [foo(1), (bar(X) :- foo(X))]),
abolish_category(Category).

succeeds(create_category_4_16) :-
succeeds(create_category_4_21) :-
create_category(Parent, [], [public([p/1, q/1])], [p(0), q(0)]),
create_category(Descendant, [extends(Parent)], [], [p(1), (p(X) :- ^^p(X)), q(1), (q(X) :- ::p(X))]),
abolish_category(Descendant),
abolish_category(Parent).

succeeds(create_category_4_17) :-
succeeds(create_category_4_22) :-
create_category(Category, [], [op(567, xfx, foo)], []),
{\+ current_op(567, xfx, foo)},
abolish_category(Category).

throws(create_category_4_18, error(permission_error(implement, self, _), logtalk(create_category(Category, [implements(Category)], [], []), _))) :-
throws(create_category_4_23, error(permission_error(implement, self, _), logtalk(create_category(Category, [implements(Category)], [], []), _))) :-
% delay the error to runtime
{create_category(Category, [implements(Category)], [], [])}.

throws(create_category_4_19, error(permission_error(extend, self, _), logtalk(create_category(Category, [extends(Category)], [], []), _))) :-
throws(create_category_4_24, error(permission_error(extend, self, _), logtalk(create_category(Category, [extends(Category)], [], []), _))) :-
% delay the error to runtime
{create_category(Category, [extends(Category)], [], [])}.

throws(create_category_4_20, error(permission_error(complement, self, _), logtalk(create_category(Category, [complements(Category)], [], []), _))) :-
throws(create_category_4_25, error(permission_error(complement, self, _), logtalk(create_category(Category, [complements(Category)], [], []), _))) :-
% delay the error to runtime
{create_category(Category, [complements(Category)], [], [])}.

throws(create_category_4_21, error(type_error(category, Protocol), logtalk(create_category(Category, [extends(Protocol)], [], []), _))) :-
throws(create_category_4_26, error(type_error(category, Protocol), logtalk(create_category(Category, [extends(Protocol)], [], []), _))) :-
create_protocol(Protocol, [], []),
% delay the error to runtime
{create_category(Category, [extends(Protocol)], [], [])}.

throws(create_category_4_22, error(type_error(category, Object), logtalk(create_category(Category, [extends(Object)], [], []), _))) :-
throws(create_category_4_27, error(type_error(category, Object), logtalk(create_category(Category, [extends(Object)], [], []), _))) :-
create_object(Object, [], [], []),
% delay the error to runtime
{create_category(Category, [extends(Object)], [], [])}.

throws(create_category_4_23, error(type_error(protocol, Category1), logtalk(create_category(Category2, [implements(Category1)], [], []), _))) :-
throws(create_category_4_28, error(type_error(protocol, Category1), logtalk(create_category(Category2, [implements(Category1)], [], []), _))) :-
create_category(Category1, [], [], []),
% delay the error to runtime
{create_category(Category2, [implements(Category1)], [], [])}.

throws(create_category_4_24, error(type_error(protocol, Object), logtalk(create_category(Category, [implements(Object)], [], []), _))) :-
throws(create_category_4_29, error(type_error(protocol, Object), logtalk(create_category(Category, [implements(Object)], [], []), _))) :-
create_object(Object, [], [], []),
% delay the error to runtime
{create_category(Category, [implements(Object)], [], [])}.
Oops, something went wrong.

0 comments on commit ac02826

Please sign in to comment.