packages-chr
packages-chr copied to clipboard
The line number of "Undeclared constraint" is wrong when using `include`
The reproduce steps as follows.
- Create two files.
main.pl
:- debug.
:- use_module(library(chr)).
:- chr_constraint c/1.
:- include('test.pl').
test.pl
test0 :- true.
test :- do_test.
c(X,Y,Z) <=> true. %% line number 10
- In REPL
?- consult(["main.pl"]).
================================================================================
CHR compiler ERROR: invalid syntax "c(_78356,_78358,_78360)".
`--> Undeclared constraint _78370/_78372 in head of rule number 1 at e:/work-pl/prolog/code/include/main.pl:10.
Constraint should be one of [c/1].
================================================================================
true.
Notice that the compiling error shows the wrong location main.pl:10
. It is should be in test.pl:10
.