optional from eca test

This commit is contained in:
koniifer 2024-11-05 18:07:04 +00:00
parent 87cb77a553
commit d3ee72306e
3 changed files with 16 additions and 0 deletions

View file

@ -614,6 +614,18 @@ main := fn(): uint {
}
```
#### optional_from_eca
```hb
main := fn(): uint {
a := @as(?uint, @eca(0, 0, 0, 0))
if a == null {
die
}
return a
}
```
#### inlining_issues
```hb
main := fn(): void {

View file

@ -4594,5 +4594,6 @@ mod tests {
global_aliasing_overptimization;
overwrite_aliasing_overoptimization;
more_if_opts;
optional_from_eca;
}
}

View file

@ -0,0 +1,3 @@
test.hb:8:2: can't prove the value is not 'null', use '@unwrap(<opt>)' if you believe compiler is stupid, or explicitly check for null and handle it ('if <opt> == null { /* handle */ } else { /* use opt */ }')
return a
^