Skip to content

Commit

Permalink
fix swizzle in for in statement
Browse files Browse the repository at this point in the history
  • Loading branch information
laytan committed Oct 2, 2024
1 parent 613f231 commit 420e442
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/llvm_backend_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,7 @@ gb_internal lbValue lb_addr_get_ptr(lbProcedure *p, lbAddr const &addr) {

case lbAddr_Swizzle:
case lbAddr_SwizzleLarge:
// TOOD(bill): is this good enough logic?
break;
return lb_address_from_load(p, lb_addr_load(p, addr));
}

return addr.addr;
Expand Down
1 change: 1 addition & 0 deletions tests/issues/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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_various_issues.odin %COMMON% || exit /b

@echo off

Expand Down
1 change: 1 addition & 0 deletions tests/issues/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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_various_issues.odin $COMMON
if [[ $($ODIN build ../test_issue_2395.odin $COMMON 2>&1 >/dev/null | grep -c "Error:") -eq 2 ]] ; then
echo "SUCCESSFUL 1/1"
else
Expand Down
17 changes: 17 additions & 0 deletions tests/issues/test_various_issues.odin
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package test_issues

import "core:testing"

// Tests issue #1730 https://github.com/odin-lang/Odin/issues/1730
@(test)
test_issue_1730 :: proc(t: ^testing.T) {
ll := [4]int{1, 2, 3, 4}
for l, i in ll.yz {
testing.expect(t, i <= 1)
if i == 0 {
testing.expect_value(t, l, 2)
} else if i == 1 {
testing.expect_value(t, l, 3)
}
}
}

0 comments on commit 420e442

Please sign in to comment.