Skip to content

Commit

Permalink
Merge pull request #1489 from actonlang/add-exception-test
Browse files Browse the repository at this point in the history
Add exception test
  • Loading branch information
plajjan authored Sep 12, 2023
2 parents 124b2f9 + cdba445 commit e96ffd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
23 changes: 8 additions & 15 deletions base/builtin/int.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ B_int B_IntegralD_intD___add__(B_IntegralD_int wit, B_int a, B_int b) {
}

B_complex B_IntegralD_intD___complex__(B_IntegralD_int wit, B_int a) {
fprintf(stderr,"Number.__complex__ not implemented for int");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError, to$str("Number.__complex__ not implemented for int")));
}

B_int B_IntegralD_intD___fromatom__(B_IntegralD_int wit, B_atom a) {
Expand Down Expand Up @@ -214,13 +213,11 @@ B_int B_IntegralD_intD___pos__(B_IntegralD_int wit, B_int a) {
}

$WORD B_IntegralD_intD_real(B_IntegralD_int wit, B_int a, B_Real wit2) {
fprintf(stderr,"Number.__real__ not implemented for int");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Number.__real__ not implemented for int")));
}

$WORD B_IntegralD_intD_imag(B_IntegralD_int wit, B_int a, B_Real wit2) {
fprintf(stderr,"Number.__imag__ not implemented for int");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Number.__imag__ not implemented for int")));
}

$WORD B_IntegralD_intD___abs__(B_IntegralD_int wit, B_int a, B_Real wit2) {
Expand Down Expand Up @@ -369,30 +366,26 @@ B_int B_IntegralD_intD___rshift__(B_IntegralD_int wit, B_int a, B_int b) {

B_int B_IntegralD_intD___invert__(B_IntegralD_int wit, B_int a) {
//return toB_i64(~a->val);
fprintf(stderr,"Number.__invert__ not implemented for int\n");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Number.__invert__ not implemented for int")));
}


// LogicalB_int ////////////////////////////////////////////////////////////////////////////////////////

B_int B_LogicalD_IntegralD_intD___and__(B_LogicalD_IntegralD_int wit, B_int a, B_int b) {
// return toB_i64(a->val & b->val);
fprintf(stderr,"Protocol Logical not implemented for int; use i64\n");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Protocol Logical not implemented for int; use i64\n")));
}

B_int B_LogicalD_IntegralD_intD___or__(B_LogicalD_IntegralD_int wit, B_int a, B_int b) {
// return toB_i64(a->val | b->val);
fprintf(stderr,"Protocol Logical not implemented for int; use i64\n");
exit(1);
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Protocol Logical not implemented for int; use i64\n")));
}

B_int B_LogicalD_IntegralD_intD___xor__(B_LogicalD_IntegralD_int wit, B_int a, B_int b) {
// return toB_i64(a->val ^ b->val);
fprintf(stderr,"Protocol Logical not implemented for int; use i64\n");
exit(1);
}
$RAISE((B_BaseException)$NEW(B_NotImplementedError,to$str("Protocol Logical not implemented for int; use i64\n")));
}

// B_MinusD_IntegralD_int ////////////////////////////////////////////////////////////////////////////////////////

Expand Down
5 changes: 5 additions & 0 deletions test/core_lang_auto/exceptions.act
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def fun7(n,out):


actor main(env):
try:
raise Err("err")
except Exception:
pass

out1 = []
fun1(0,out1)
fun1(1,out1)
Expand Down

0 comments on commit e96ffd5

Please sign in to comment.