From c24a51b6339d2a83949cfa8d03616adab535603a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bennet=20Ble=C3=9Fmann?= Date: Sat, 17 Aug 2024 23:33:32 +0200 Subject: [PATCH] fix looping from issue 2467 --- src/toplevel.pl | 4 +++- tests-pl/invalid_decl_issue2467.pl | 1 + .../scryer/cli/src_tests/directive_errors.md | 21 +++++++++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 tests-pl/invalid_decl_issue2467.pl diff --git a/src/toplevel.pl b/src/toplevel.pl index 67408cd2..c6e2990d 100644 --- a/src/toplevel.pl +++ b/src/toplevel.pl @@ -168,7 +168,9 @@ repl :- %% Enable op declarations with lists of operands, i.e., %% :- op(900, fy, [$,@]). -user:term_expansion((:- op(Pred, Spec, [Op | OtherOps])), OpResults) :- +user:term_expansion((:- op(Pred, Spec, Ops)), OpResults) :- + ground(Ops), + Ops = [Op | OtherOps], expand_op_list([Op | OtherOps], Pred, Spec, OpResults). expand_op_list([], _, _, []). diff --git a/tests-pl/invalid_decl_issue2467.pl b/tests-pl/invalid_decl_issue2467.pl new file mode 100644 index 00000000..e366e335 --- /dev/null +++ b/tests-pl/invalid_decl_issue2467.pl @@ -0,0 +1 @@ +:- D. \ No newline at end of file diff --git a/tests/scryer/cli/src_tests/directive_errors.md b/tests/scryer/cli/src_tests/directive_errors.md index 48b25fe0..2beb7c73 100644 --- a/tests/scryer/cli/src_tests/directive_errors.md +++ b/tests/scryer/cli/src_tests/directive_errors.md @@ -59,13 +59,14 @@ $ scryer-prolog -f --no-add-history tests-pl/invalid_decl10.pl -g halt ``` -The following test doesn't appear to terminate so its moved to a block quote for now +FIXME I belive the following test should result in a `error(instantiation_error,load/1)` error instead of the current error. -> ```trycmd -> $ scryer-prolog -f --no-add-history tests-pl/invalid_decl11.pl -g halt -> % Warning: singleton variables Var at line 0 of invalid_decl11.pl -> error(instantiation_error,load/1). -> ``` +```trycmd +$ scryer-prolog -f --no-add-history tests-pl/invalid_decl11.pl -g halt +% Warning: singleton variables Var at line 0 of invalid_decl11.pl + error(type_error(list,todo_insert_invalid_term_here),load/1). + +``` ```trycmd $ scryer-prolog -f --no-add-history tests-pl/invalid_decl12.pl -g halt @@ -96,3 +97,11 @@ $ scryer-prolog -f --no-add-history tests-pl/invalid_decl16.pl -g halt error(permission_error(modify,operator,','),load/1). ``` + + +```trycmd +$ scryer-prolog -f --no-add-history tests-pl/invalid_decl_issue2467.pl -g halt +% Warning: singleton variables D at line 0 of invalid_decl_issue2467.pl + error(instantiation_error,load/1). + +``` -- 2.54.0