Properly recast nested recursion pointers to their expanded layouts as needed

When we load a structure with a nested recursive pointer, the pointer
may be loaded opaquely. We need to refine it to the concrete type wanted
by the layout.

This conversion can be removed after we upgrade to LLVM 15.

Closes #5162
This commit is contained in:
Ayaz Hafiz 2023-03-21 13:31:47 -04:00
parent 63ef4a486f
commit 3a960e7809
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 59 additions and 25 deletions

View file

@ -2235,3 +2235,29 @@ fn refcount_nullable_unwrapped_needing_no_refcount_issue_5027() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn issue_5162_recast_nested_nullable_unwrapped_layout() {
assert_evals_to!(
indoc!(
r###"
app "test" provides [main] to "./platform"
Concept : [
AtomicConcept,
ExistentialRestriction { role : Str, concept : Concept }
]
bottom : Concept
bottom = AtomicConcept
main =
when Dict.single bottom 0 is
_ -> Bool.true
"###
),
true,
bool
);
}