From 058b9c5e512f80fd68f93713547961009be5a44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Sun, 4 Aug 2024 15:16:37 +0200 Subject: [PATCH] switch invalid term from type to domain error --- src/machine/machine_errors.rs | 2 -- src/machine/machine_state.rs | 4 ++-- tests/scryer/cli/src_tests/directive_errors.md | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/machine/machine_errors.rs b/src/machine/machine_errors.rs index cb4edba8b..9f22d0e3b 100644 --- a/src/machine/machine_errors.rs +++ b/src/machine/machine_errors.rs @@ -38,7 +38,6 @@ pub(crate) enum ValidType { Callable, Character, Compound, - Directive, Evaluable, Float, InByte, @@ -74,7 +73,6 @@ impl ValidType { // ValidType::PredicateIndicator => atom!("predicate_indicator"), // ValidType::Variable => atom!("variable") ValidType::TcpListener => atom!("tcp_listener"), - ValidType::Directive => atom!("directive"), } } } diff --git a/src/machine/machine_state.rs b/src/machine/machine_state.rs index eecac17fb..5376042ce 100644 --- a/src/machine/machine_state.rs +++ b/src/machine/machine_state.rs @@ -981,8 +981,8 @@ impl MachineState { pub(crate) fn directive_error(&mut self, err: DirectiveError) -> MachineError { match err { - DirectiveError::ExpectedDirective(_term) => self.type_error( - ValidType::Directive, + DirectiveError::ExpectedDirective(_term) => self.domain_error( + DomainErrorType::Directive, atom_as_cell!(atom!("todo_insert_invalid_term_here")), ), DirectiveError::InvalidDirective(name, arity) => { diff --git a/tests/scryer/cli/src_tests/directive_errors.md b/tests/scryer/cli/src_tests/directive_errors.md index 95ed55a41..48b25fe05 100644 --- a/tests/scryer/cli/src_tests/directive_errors.md +++ b/tests/scryer/cli/src_tests/directive_errors.md @@ -30,7 +30,7 @@ $ scryer-prolog -f --no-add-history tests-pl/invalid_decl5.pl -g halt ```trycmd $ scryer-prolog -f --no-add-history tests-pl/invalid_decl6.pl -g halt - error(type_error(directive,todo_insert_invalid_term_here),load/1). + error(domain_error(directive,todo_insert_invalid_term_here),load/1). ```