Branch: Tag:

2014-10-25

2014-10-25 10:09:07 by Arne Goedeke <el@laramies.com>

hash_value: fix hashing of trampolines

Two trampolines are equal if there are the same function and created in
the same scope. This patch makes sure hash_svalue is compatible and
trampolines can now be reliably used as hash keys.

Thanks to Stefan Gluszek <stefang@opera.com> for reporting this issue.

11035:   test_hash_value(ADT.Stack)   dnl test_hash_value(String)   test_hash_value(typeof(true)) + test_any([[ +  int v = 0;    -  +  void trampoline() { +  v = 1; +  }; +  +  int(0..1) check_hash() +  { +  function f1 = trampoline; +  function f2 = trampoline; +  return hash_value(f1) == hash_value(f2); +  }; +  +  return check_hash(); + ]], 1) +  +    // - indices   test_equal(indices("foo"),({0,1,2}))   test_equal(indices(({'f','o','o'})),({0,1,2}))