do not unify partial strings unless they coincide in memory
This commit is contained in:
@@ -264,11 +264,11 @@ impl MachineState {
|
||||
if let Some(c) = s2.head() {
|
||||
pdl.push(Addr::Con(Constant::String(s1.push_char(c))));
|
||||
pdl.push(Addr::Con(Constant::String(s2.tail())));
|
||||
} else if !s2.is_expandable() {
|
||||
} else if s2.is_expandable() {
|
||||
return s1 == s2;
|
||||
} else {
|
||||
s1.set_non_expandable();
|
||||
}/*else {
|
||||
//TODO: unify the tails of s1 and s2? I guess?
|
||||
}*/
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if s2.head().is_none() {
|
||||
|
||||
@@ -1881,6 +1881,9 @@ fn test_queries_on_string_lists()
|
||||
assert_prolog_success!(&mut wam, "?- partial_string(\"abc\", X).",
|
||||
[["X = [a, b, c | _]"]]);
|
||||
|
||||
assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), partial_string(\"abc\", Y), matcher(X, V),
|
||||
matcher(Y, Z), V = Z.");
|
||||
|
||||
submit(&mut wam, "matcher([a, b, c | X], X).");
|
||||
|
||||
assert_prolog_success!(&mut wam, "?- partial_string(\"abc\", X), matcher(X, Y).",
|
||||
|
||||
Reference in New Issue
Block a user