for referenced values, use allocas instead of phi nodes

This commit is contained in:
Brendan Hansknecht 2024-07-20 19:52:11 -07:00
parent ee7f1e39c7
commit c5a74bdc12
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
3 changed files with 87 additions and 16 deletions

View file

@ -4664,3 +4664,40 @@ fn multiple_uses_of_bool_true_tag_union() {
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn issue_6139() {
assert_evals_to!(
indoc!(
r#"
buggy = \node, seen ->
if List.contains seen node then
seen
else
# node = "B"
nextNode = stepNode node
# node = "C"
buggy nextNode (List.append seen node)
stepNode = \node ->
when node is
"A" -> "B"
"B" -> "C"
"C" -> "D"
"D" -> "A"
_ -> crash ""
buggy "A" []
"#
),
RocList::from_slice(&[
RocStr::from("A"),
RocStr::from("B"),
RocStr::from("C"),
RocStr::from("D"),
]),
RocList<RocStr>
);
}