Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong priority reported for the ('|')/2 operator #1571

Closed
pmoura opened this issue Aug 15, 2022 · 3 comments
Closed

Wrong priority reported for the ('|')/2 operator #1571

pmoura opened this issue Aug 15, 2022 · 3 comments

Comments

@pmoura
Copy link
Contributor

pmoura commented Aug 15, 2022

In the rebis-dev branch (df779bb):

?- current_op(P, T, '|').
   P = 0, T = xfy
;  false.

Same issue in the master branch.

After some more digging, I believe this bug is responsible for #1569. The FCube port only defines this operator if the backend Prolog system doesn't define it itself. But a compliant definition is assumed (actual code simplified here):

:- if(\+ current_op(_, _, '|')).
	:- public(op(1100, xfy, '|')).
:- endif.
@pmoura
Copy link
Contributor Author

pmoura commented Aug 15, 2022

Pushed a Logtalk test that exposes this bug:

$ logtalk_tester -p scryer -s ~/Documents/Logtalk/
% Batch testing started @ 2022-08-15 18:44:28
%         Logtalk version: 3.58.0-b01
%         Scryer Prolog version: 0.9.0
%
% logtalk3/tests/prolog/syntax/operators
%         57 tests: 0 skipped, 56 passed, 1 failed (0 flaky)
%         completed tests from object tests in 9 seconds
%         clause coverage n/a
%
% Compilation errors/warnings and failed unit tests
% (compilation errors/warnings might be expected depending on the test)
!     lgt_operators_57: failure (in 0.0 seconds)
!       test assertion failed: 0>=1001
!       in file logtalk3/tests/prolog/syntax/operators/tests.lgt between lines 238-243
%
% Failed tests
logtalk3/tests/prolog/syntax/operators/tests.lgt - lgt_operators_57 @ tests
%
% 1 test sets: 1 completed, 0 skipped, 0 broken, 0 timedout, 0 crashed
% 57 tests: 0 skipped, 56 passed, 1 failed (0 flaky)
%
% Batch testing ended @ 2022-08-15 18:44:40

@triska
Copy link
Contributor

triska commented Aug 15, 2022

The same problem is present in master, where we get:

?- current_op(Pre, Fix, '|').
   Pre = 0, Fix = xfy, unexpected
;  false.
?- X = (a|b).
   error(syntax_error(incomplete_reduction),read_term/3:1). % expected
?- use_module(library(dcgs)).
   true.
?- current_op(Pre, Fix, '|').
   Pre = 1105, Fix = xfy % expected
;  false.
?- X = (a|b).
   X = (a | b). % expected

@pmoura
Copy link
Contributor Author

pmoura commented Aug 20, 2022

Thanks for the fix. All tests pass now:

$ logtalk_tester -p scryer -s ~/Documents/Logtalk/
% Batch testing started @ 2022-08-20 15:53:18
%         Logtalk version: 3.58.0-b01
%         Scryer Prolog version: 0.9.0
%
% logtalk3/tests/prolog/syntax/operators
%         57 tests: 1 skipped, 56 passed, 0 failed (0 flaky)
%         completed tests from object tests in 10 seconds
%         clause coverage n/a
%
% Skipped tests
logtalk3/tests/prolog/syntax/operators/tests.lgt - lgt_operators_57 @ tests
%
% 1 test sets: 1 completed, 0 skipped, 0 broken, 0 timedout, 0 crashed
% 57 tests: 1 skipped, 56 passed, 0 failed (0 flaky)
%
% Batch testing ended @ 2022-08-20 15:53:29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants