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

Bug in the implementation of conditional compilation directives #39

Closed
pmoura opened this issue Jun 7, 2023 · 1 comment
Closed

Bug in the implementation of conditional compilation directives #39

pmoura opened this issue Jun 7, 2023 · 1 comment

Comments

@pmoura
Copy link

pmoura commented Jun 7, 2023

Running the Logtalk test set for conditional compilation directives (git version) shows a failed test:

$ logtalk_tester -p gnu
% Batch testing started @ 2023-06-07 19:29:58
%         Logtalk version: 3.67.0-b01
%         GNU Prolog version: 1.6.0
%
% Documents/Logtalk/logtalk3/tests/prolog/directives/conditional_compilation
%         39 tests: 0 skipped, 38 passed, 1 failed (0 flaky)
%         completed tests from object tests in 3 seconds
%         clause coverage n/a
%
% Compilation errors/warnings and failed unit tests
% (compilation errors/warnings might be expected depending on the test)
!     conditional_compilation_f22: failure (in 0.0 seconds)
!       test goal succeeded but should have failed
!       in file Documents/Logtalk/logtalk3/tests/prolog/directives/conditional_compilation/tests.lgt between lines 123-124
%
% Failed tests
Documents/Logtalk/logtalk3/tests/prolog/directives/conditional_compilation/tests.lgt - conditional_compilation_f22 @ tests
%
% 1 test sets: 1 completed, 0 skipped, 0 broken, 0 timedout, 0 crashed
% 39 tests: 0 skipped, 38 passed, 1 failed (0 flaky)
%
% Batch testing ended @ 2023-06-07 19:30:02

A simplified test file that exposes the same bug is:

:- if(fail).
	f20.
:- elif(fail).
	f21.
	:- if(true).
		f22.
	:- elif(true).
		f23.
	:- else.
		f24.
	:- endif.
:- elif(fail).
	f25.
:- else.
	s7.
:- endif.

After loading it:

$ gprolog
GNU Prolog 1.6.0 (64 bits)
Compiled Jun  7 2023, 16:40:18 with /opt/local/bin/gcc-mp-12
Copyright (C) 1999-2023 Daniel Diaz

| ?- [ccbug].
compiling /Users/pmoura/ccbug.pl for byte code...
/Users/pmoura/ccbug.pl compiled, 16 lines read - 272 bytes written, 3 ms

yes
| ?- f22.

yes

Only the call to s7 should succeed; Calling any of the fXX predicates should throw an existence error.

@pmoura
Copy link
Author

pmoura commented Jun 9, 2023

Fix confirmed. Thanks!

@pmoura pmoura closed this as completed Jun 9, 2023
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

1 participant