Nullable pointer and loop inlining tests. #22

Closed
peony wants to merge 7 commits from peony/holey-bytes:trunk into trunk
2 changed files with 19 additions and 3 deletions
Showing only changes of commit e27a218746 - Show all commits

View file

@ -1042,16 +1042,32 @@ main := fn(): uint {
} }
``` ```
#### inlining_loops
```hb
x := 1
foo := fn(): int {
loop if true break
x = 0
}
main := fn(): int {
@inline(foo)
return x
}
```
#### null_check_test #### null_check_test
```hb ```hb
main := fn(): unit { main := fn(): uint {
ptr := @as(?^uint, null) ptr := @as(?^uint, null)
*ptr = 0 value := 0
ptr = &value
if ptr == null { if ptr == null {
return 1 return 1
} }
return *ptr return *ptr
} }
``` ```

View file