Skip to content

Commit

Permalink
Error messages for unsupported cases
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoeilers committed Nov 29, 2024
1 parent 081945a commit 5818baf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nagini_translation/resources/bool.sil
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function int___mul__(self: Int, other: Int): Int

function int___pow__(self: Int, other: Int): Int
decreases _
requires other >= 0
requires @error("** is currently only supported for non-negative exponents.")(other >= 0)
{
___pow(self, other)
}
Expand Down
2 changes: 2 additions & 0 deletions src/nagini_translation/translators/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,8 @@ def translate_operator(self, left: Expr, right: Expr, left_type: PythonType,

if left_type == right_type or isinstance(right_type, TypeVar):
call_stmt, call = self.get_func_or_method_call(left_type, LEFT_OPERATOR_FUNCTIONS[type(node.op)], [left, right], [left_type, right_type], node, ctx)
if call is None:
raise UnsupportedException(node, "Unsupported binary operator")
return stmt + call_stmt, call

else:
Expand Down

0 comments on commit 5818baf

Please sign in to comment.