Fix #7708: compare a polymorphic record's constant parameters by value in subst_unify

This commit is contained in:
gingerBill committed 2026-10-02 16:42:33 +01:00
1 parent 08dd25e28f
commit ff02184b2e
3 files changed
+14

No files matched your search

+5
View File
@@ -2127,6 +2127,11 @@ gb_internal SubstResult subst_unify(CheckerContext *c, Type *pattern, Type *sour
if (r != Subst_Matched) {
return r; // NoMatch or Unhandled
}
// e.g. `M(1, 1, $T)` vs `M(3, 3, f64)`
if (s_e->kind == Entity_Constant && t_e->kind == Entity_Constant &&
!compare_exact_values(Token_CmpEq, s_e->Constant.value, t_e->Constant.value)) {
return Subst_NoMatch;
}
}
}
return Subst_Matched;
+2
View File
@@ -84,6 +84,8 @@ clang -c ..\test_issue_sysv_abi.c -o test_issue_sysv_abi_c.o || exit /b
..\..\..\odin test ..\test_issue_7316.odin %COMMON% || exit /b
..\..\..\odin test ..\test_issue_7566.odin %COMMON% || exit /b
..\..\..\odin test ..\test_issue_poly_using_subtype.odin %COMMON% || exit /b
..\..\..\odin test ..\test_issue_7708.odin %COMMON% || exit /b
..\..\..\odin check ..\test_issue_7708_mismatch.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "2" || exit /b
..\..\..\odin test ..\test_issue_7587.odin %COMMON% || exit /b
..\..\..\odin run ..\test_issue_7596.odin %COMMON% || exit /b
+7
View File
@@ -105,6 +105,13 @@ $ODIN run ../test_issue_7564.odin $COMMON
$ODIN test ../test_issue_7316.odin $COMMON
$ODIN test ../test_issue_7566.odin $COMMON
$ODIN test ../test_issue_poly_using_subtype.odin $COMMON
$ODIN test ../test_issue_7708.odin $COMMON
if [[ $($ODIN check ../test_issue_7708_mismatch.odin $COMMON_CHECK 2>&1 >/dev/null | grep -c "Error:") -eq 2 ]]; then
echo "SUCCESSFUL 1/1"
else
echo "SUCCESSFUL 0/1"
exit 1
fi
$ODIN test ../test_issue_7587.odin $COMMON
$ODIN run ../test_issue_7596.odin $COMMON
$ODIN test ../test_issue_7421.odin $COMMON