Skip to content

Commit

Permalink
Fix univ/2 bug converting from strings, re issue #164
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed May 10, 2023
1 parent 1789015 commit f99576b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/predicates.c
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,12 @@ static bool fn_iso_univ_2(query *q)
cell *tmp2 = alloc_on_tmp(q, h->nbr_cells);
check_heap_error(tmp2);
copy_cells(tmp2, h, h->nbr_cells);

if (is_cstring(tmp2)) {
share_cell(tmp2);
convert_to_literal(q->st.m, tmp2);
}

p2 = LIST_TAIL(p2);
arity++;
}
Expand All @@ -1855,11 +1861,6 @@ static bool fn_iso_univ_2(query *q)
cell *tmp2 = get_tmp_heap(q, 0);
pl_idx_t nbr_cells = tmp_heap_used(q);

if (is_cstring(tmp2) && !is_string(tmp2)) {
share_cell(tmp2);
convert_to_literal(q->st.m, tmp2);
}

if (!is_interned(tmp2) && arity)
return throw_error(q, tmp2, q->st.curr_frame, "type_error", "atom");

Expand Down

0 comments on commit f99576b

Please sign in to comment.