consistently name function symbols

previously the dev backend did not take into account lambda name information to generate function names. This could cause the same function name to be defined twice
This commit is contained in:
Folkert 2023-06-10 19:51:09 +02:00
parent 58c6c664fd
commit 59da1ea891
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
4 changed files with 225 additions and 9 deletions

View file

@ -335,15 +335,15 @@ trait Backend<'a> {
let mut buf = String::with_capacity(1024);
for a in arguments {
write!(buf, "{:?}", self.interner().dbg_deep(a)).expect("capacity");
write!(buf, "{:?}", self.interner().dbg_stable(a)).expect("capacity");
}
// lambda set should not matter; it should already be added as an argument
// but the niche of the lambda name may be the only thing differentiating two different
// implementations of a function with the same symbol
write!(buf, "{:?}", name.niche().dbg_deep(self.interner())).expect("capacity");
write!(buf, "{:?}", name.niche().dbg_stable(self.interner())).expect("capacity");
write!(buf, "{:?}", self.interner().dbg_deep(result)).expect("capacity");
write!(buf, "{:?}", self.interner().dbg_stable(result)).expect("capacity");
// NOTE: due to randomness, this will not be consistent between runs
let mut state = roc_collections::all::BuildHasher::default().build_hasher();