packages-chr icon indicating copy to clipboard operation
packages-chr copied to clipboard

The line number of "Undeclared constraint" is wrong when using `include`

Open chansey97 opened this issue 2 years ago • 0 comments

The reproduce steps as follows.

  1. 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
  1. 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.

chansey97 avatar May 11 '22 10:05 chansey97