diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-06-05 07:31:03 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-06-05 07:48:10 -0400 |
| commit | 36b41ce163843c9524d789e6edbc171c1d723e85 (patch) | |
| tree | 7c7b89a429bf9b2f37410b8ae8cd0128296728fe /tests/issues | |
| parent | 9eefa2006eccdf942c01fc1421784edea78c5591 (diff) | |
Let compound literal array be broadcast to a struct field of arrays
Fixes #4364
Patch courtesy of @cribalik
Diffstat (limited to 'tests/issues')
| -rw-r--r-- | tests/issues/run.bat | 1 | ||||
| -rwxr-xr-x | tests/issues/run.sh | 1 | ||||
| -rw-r--r-- | tests/issues/test_issue_4364.odin | 18 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/issues/run.bat b/tests/issues/run.bat index bbe9b7ca6..8e71c3f3d 100644 --- a/tests/issues/run.bat +++ b/tests/issues/run.bat @@ -17,6 +17,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style ..\..\..\odin test ..\test_issue_2637.odin %COMMON% || exit /b ..\..\..\odin test ..\test_issue_2666.odin %COMMON% || exit /b ..\..\..\odin test ..\test_issue_4210.odin %COMMON% || exit /b +..\..\..\odin test ..\test_issue_4364.odin %COMMON% || exit /b ..\..\..\odin test ..\test_issue_4584.odin %COMMON% || exit /b ..\..\..\odin build ..\test_issue_5043.odin %COMMON% || exit /b ..\..\..\odin build ..\test_issue_5097.odin %COMMON% || exit /b diff --git a/tests/issues/run.sh b/tests/issues/run.sh index 228efce7f..fc8ab513f 100755 --- a/tests/issues/run.sh +++ b/tests/issues/run.sh @@ -18,6 +18,7 @@ $ODIN test ../test_issue_2615.odin $COMMON $ODIN test ../test_issue_2637.odin $COMMON $ODIN test ../test_issue_2666.odin $COMMON $ODIN test ../test_issue_4210.odin $COMMON +$ODIN test ../test_issue_4364.odin $COMMON $ODIN test ../test_issue_4584.odin $COMMON if [[ $($ODIN build ../test_issue_2395.odin $COMMON 2>&1 >/dev/null | grep -c "Error:") -eq 2 ]] ; then echo "SUCCESSFUL 1/1" diff --git a/tests/issues/test_issue_4364.odin b/tests/issues/test_issue_4364.odin new file mode 100644 index 000000000..817a1a26b --- /dev/null +++ b/tests/issues/test_issue_4364.odin @@ -0,0 +1,18 @@ +// Tests issue #4364 https://github.com/odin-lang/Odin/issues/4364 +package test_issues + +import "core:testing" + +@test +test_const_array_fill_assignment :: proc(t: ^testing.T) { + MAGIC :: 12345 + Struct :: struct {x: int} + CONST_ARR : [4]Struct : Struct{MAGIC} + arr := CONST_ARR + + testing.expect_value(t, len(arr), 4) + testing.expect_value(t, arr[0], Struct{MAGIC}) + testing.expect_value(t, arr[1], Struct{MAGIC}) + testing.expect_value(t, arr[2], Struct{MAGIC}) + testing.expect_value(t, arr[3], Struct{MAGIC}) +} |