From d0cbdb13e531f2ef12d467bac867d7afb652536f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 29 Mar 2017 23:09:40 +0200 Subject: [PATCH] Fixed misleading error message concerning negated, unsupported body literals. --- CHANGELOG.md | 1 + include/anthem/Body.h | 5 ++++- include/anthem/StatementVisitor.h | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0afee..8a25e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Features: Bug Fixes: * fixes incorrectly simplified rules with comparisons +* fixes misleading error message concerning negated, unsupported body literals ## 0.1.2 (2017-03-23) diff --git a/include/anthem/Body.h b/include/anthem/Body.h index 60c6969..4f3f347 100644 --- a/include/anthem/Body.h +++ b/include/anthem/Body.h @@ -144,8 +144,11 @@ struct BodyLiteralTranslateVisitor struct BodyBodyLiteralTranslateVisitor { - std::experimental::optional visit(const Clingo::AST::Literal &literal, const Clingo::AST::BodyLiteral &, Context &context) + std::experimental::optional visit(const Clingo::AST::Literal &literal, const Clingo::AST::BodyLiteral &bodyLiteral, Context &context) { + if (bodyLiteral.sign != Clingo::AST::Sign::None) + throwErrorAtLocation(bodyLiteral.location, "only positive body literals supported currently", context); + return literal.data.accept(BodyLiteralTranslateVisitor(), literal, context); } diff --git a/include/anthem/StatementVisitor.h b/include/anthem/StatementVisitor.h index 4008a9c..de9e6a5 100644 --- a/include/anthem/StatementVisitor.h +++ b/include/anthem/StatementVisitor.h @@ -65,9 +65,6 @@ struct StatementVisitor { const auto &bodyLiteral = *i; - if (bodyLiteral.sign != Clingo::AST::Sign::None) - throwErrorAtLocation(bodyLiteral.location, "only positive literals currently supported", context); - auto argument = bodyLiteral.data.accept(BodyBodyLiteralTranslateVisitor(), bodyLiteral, context); if (!argument)