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

fix looping from issue #2467 #2495

Merged
merged 1 commit into from
Aug 18, 2024
Merged

fix looping from issue #2467 #2495

merged 1 commit into from
Aug 18, 2024

Conversation

Skgland
Copy link
Contributor

@Skgland Skgland commented Aug 17, 2024

fixes #2467

The error for invalid_decl11.pl i.e. :- op(10, xf, [example, Var]). is probably wrong, but at least its not looping anymore.

It's currently error(type_error(list,todo_insert_invalid_term_here),load/1) but I think it should be error(instantiation_error,load/1) instead.

See the test at

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(type_error(list,todo_insert_invalid_term_here),load/1).
```

@mthom mthom merged commit 3f25ee3 into mthom:master Aug 18, 2024
13 checks passed
@triska
Copy link
Contributor

triska commented Aug 18, 2024

Thank you a lot for working on this and improving it! Yes, it should be an instantiation error. The reason is that an instantiation of the term is expected. A type error indicates that a different type is expected, and in the test case the type of the variable is not constrained in any way.

@Skgland Skgland deleted the fix2467 branch August 18, 2024 12:39
@triska
Copy link
Contributor

triska commented Aug 18, 2024

@Skgland: GNU Prolog is a good reference system in such cases:

| ?- op(10, xf, [example, Var]).
uncaught exception: error(instantiation_error,op/3)

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

Successfully merging this pull request may close these issues.

Variable as directive loops unexpectedly
3 participants