diff --git a/Examples/test-suite/ocaml/overload_bool_runme.ml b/Examples/test-suite/ocaml/overload_bool_runme.ml new file mode 100644 index 000000000..ce0ce9e40 --- /dev/null +++ b/Examples/test-suite/ocaml/overload_bool_runme.ml @@ -0,0 +1,15 @@ +open Swig +open Overload_bool + +let _ = + assert (_overloaded '(true) as string = "bool"); + assert (_overloaded '(false) as string = "bool"); + assert (_overloaded '(0) as string = "int"); + assert (_overloaded '(1) as string = "int"); + assert (_overloaded '(2) as string = "int"); + assert (_overloaded '("1234") as string = "string"); + assert (_boolfunction '(true) as string = "true"); + assert (_boolfunction '(false) as string = "false"); + assert (_intfunction '(true) as string = "int"); + assert (_intfunction '(false) as string = "int"); +;; diff --git a/Lib/ocaml/typecheck.i b/Lib/ocaml/typecheck.i index a13e1552e..9d95e2717 100644 --- a/Lib/ocaml/typecheck.i +++ b/Lib/ocaml/typecheck.i @@ -78,7 +78,7 @@ } } -%typecheck(SWIG_TYPECHECK_INTEGER) bool, oc_bool, BOOL, const bool &, const oc_bool &, const BOOL & { +%typecheck(SWIG_TYPECHECK_BOOL) bool, oc_bool, const bool &, const oc_bool & { if( !Is_block($input) ) $1 = 0; else { switch( SWIG_Tag_val($input) ) {