diff --git a/regression/orig/test055.log b/regression/orig/test055.log new file mode 100644 index 000000000..12decc137 --- /dev/null +++ b/regression/orig/test055.log @@ -0,0 +1,2 @@ +0 +3 diff --git a/regression/test055.expr b/regression/test055.expr new file mode 100644 index 000000000..00b21a292 --- /dev/null +++ b/regression/test055.expr @@ -0,0 +1,8 @@ +fun len(l) { + case l of + _ : xs -> return len(xs) + 1 + |{} -> return 0 + esac +} +write(len({})); +write(len({1, 2, 3})) \ No newline at end of file diff --git a/regression/test055.input b/regression/test055.input new file mode 100644 index 000000000..e69de29bb diff --git a/runtime/runtime.c b/runtime/runtime.c index f339db8b7..a9e51ad70 100644 --- a/runtime/runtime.c +++ b/runtime/runtime.c @@ -66,7 +66,7 @@ char* de_hash (int n) { static char *chars = (char*) BOX (NULL); static char buf[6] = {0,0,0,0,0,0}; char *p = (char *) BOX (NULL); - chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNJPQRSTUVWXYZ"; + chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; p = &buf[5]; #ifdef DEBUG_PRINT @@ -316,13 +316,16 @@ extern void* Bsexp (int n, ...) { extern int Btag (void *d, int t, int n) { data *r = (data *) BOX (NULL); - r = TO_DATA(d); + if (UNBOXED(d)) return BOX(0); + else { + r = TO_DATA(d); #ifndef DEBUG_PRINT - return BOX(TAG(r->tag) == SEXP_TAG && TO_SEXP(d)->tag == t && LEN(r->tag) == n); + return BOX(TAG(r->tag) == SEXP_TAG && TO_SEXP(d)->tag == t && LEN(r->tag) == n); #else - return BOX(TAG(r->tag) == SEXP_TAG && + return BOX(TAG(r->tag) == SEXP_TAG && GET_SEXP_TAG(TO_SEXP(d)->tag) == t && LEN(r->tag) == n); #endif + } } extern int Barray_patt (void *d, int n) { diff --git a/src/X86.ml b/src/X86.ml index 0d02f765b..87c9d9873 100644 --- a/src/X86.ml +++ b/src/X86.ml @@ -389,7 +389,7 @@ module M = Map.Make (String) (* Environment implementation *) class env = - let chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNJPQRSTUVWXYZ" in + let chars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" in let make_assoc l i = List.combine l (List.init (List.length l) (fun x -> x + i)) in let rec assoc x = function [] -> raise Not_found | l :: ls -> try List.assoc x l with Not_found -> assoc x ls in object (self)