mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Merge pull request #4350 from roc-lang/i4348
Use runtime representation of values when building structural eq
This commit is contained in:
commit
bcf2fc340d
2 changed files with 20 additions and 0 deletions
|
@ -147,6 +147,8 @@ fn build_eq<'a, 'ctx, 'env>(
|
|||
rhs_layout: &Layout<'a>,
|
||||
when_recursive: WhenRecursive<'a>,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
let lhs_layout = &lhs_layout.runtime_representation(env.layout_interner);
|
||||
let rhs_layout = &rhs_layout.runtime_representation(env.layout_interner);
|
||||
if lhs_layout != rhs_layout {
|
||||
panic!(
|
||||
"Equality of different layouts; did you have a type mismatch?\n{:?} == {:?}",
|
||||
|
|
|
@ -4085,3 +4085,21 @@ fn pattern_match_char() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn issue_4348() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
str = "z"
|
||||
(\_ ->
|
||||
when str is
|
||||
"z" -> "okay"
|
||||
_ -> "") "FAIL"
|
||||
"#
|
||||
),
|
||||
RocStr::from("okay"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue