instantiate module resolutions for meta-predicate lookups when expanding calls (#2255, #2619, #2684)
This commit is contained in:
@@ -844,6 +844,12 @@ expand_goal(UnexpandedGoals, Module, ExpandedGoals) :-
|
|||||||
UnexpandedGoals = ExpandedGoals),
|
UnexpandedGoals = ExpandedGoals),
|
||||||
!.
|
!.
|
||||||
|
|
||||||
|
module_instantiated(M, EM) :-
|
||||||
|
( var(M) ->
|
||||||
|
EM = user
|
||||||
|
; M = EM
|
||||||
|
).
|
||||||
|
|
||||||
:- non_counted_backtracking expand_goal/5.
|
:- non_counted_backtracking expand_goal/5.
|
||||||
|
|
||||||
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars, TGs) :-
|
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars, TGs) :-
|
||||||
@@ -856,9 +862,10 @@ expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars, TGs) :-
|
|||||||
),
|
),
|
||||||
( expand_goal_cases(Goals, Module, ExpandedGoals, HeadVars, TGs) ->
|
( expand_goal_cases(Goals, Module, ExpandedGoals, HeadVars, TGs) ->
|
||||||
true
|
true
|
||||||
; predicate_property(Module:Goals, meta_predicate(MetaSpecs0)),
|
; module_instantiated(Module, InstantiatedModule),
|
||||||
|
predicate_property(InstantiatedModule:Goals, meta_predicate(MetaSpecs0)),
|
||||||
MetaSpecs0 =.. [_ | MetaSpecs] ->
|
MetaSpecs0 =.. [_ | MetaSpecs] ->
|
||||||
expand_module_names(Goals, MetaSpecs, Module, ExpandedGoals, HeadVars, TGs)
|
expand_module_names(Goals, MetaSpecs, InstantiatedModule, ExpandedGoals, HeadVars, TGs)
|
||||||
; thread_goals(Goals, ExpandedGoals, (','))
|
; thread_goals(Goals, ExpandedGoals, (','))
|
||||||
; Goals = ExpandedGoals
|
; Goals = ExpandedGoals
|
||||||
)
|
)
|
||||||
@@ -886,14 +893,16 @@ expand_call_goal_(UnexpandedGoals, Module, ExpandedGoals) :-
|
|||||||
UnexpandedGoals = ExpandedGoals
|
UnexpandedGoals = ExpandedGoals
|
||||||
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
|
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
|
||||||
( Module \== user ->
|
( Module \== user ->
|
||||||
goal_expansion(UnexpandedGoals1, user, Goals),
|
goal_expansion(UnexpandedGoals1, user, Goals)
|
||||||
( predicate_property(Module:Goals, meta_predicate(MetaSpecs0)),
|
; Goals = UnexpandedGoals1
|
||||||
|
),
|
||||||
|
module_instantiated(Module, InstantiatedModule),
|
||||||
|
( predicate_property(InstantiatedModule:Goals, meta_predicate(MetaSpecs0)),
|
||||||
MetaSpecs0 =.. [_ | MetaSpecs] ->
|
MetaSpecs0 =.. [_ | MetaSpecs] ->
|
||||||
expand_module_names(Goals, MetaSpecs, Module, ExpandedGoals, [], [])
|
expand_module_names(Goals, MetaSpecs, InstantiatedModule, ExpandedGoals, [], [])
|
||||||
; ExpandedGoals = Goals
|
; ExpandedGoals = Goals
|
||||||
)
|
)
|
||||||
; ExpandedGoals = UnexpandedGoals1
|
; ExpandedGoals = UnexpandedGoals1
|
||||||
)
|
|
||||||
).
|
).
|
||||||
|
|
||||||
:- non_counted_backtracking transitive_goal/3.
|
:- non_counted_backtracking transitive_goal/3.
|
||||||
|
|||||||
Reference in New Issue
Block a user