markused: fix option array element (fix #23089) (#25179)

This commit is contained in:
Felipe Pena 2025-08-29 01:53:01 -03:00 committed by GitHub
parent 1ba45123ec
commit 38bfc482ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 0 deletions

View file

@ -432,6 +432,9 @@ fn (mut w Walker) expr(node_ ast.Expr) {
if !w.uses_array && !w.is_direct_array_access {
w.uses_array = true
}
if node.elem_type.has_flag(.option) {
w.used_option++
}
}
ast.Assoc {
w.exprs(node.exprs)

View file

@ -0,0 +1,6 @@
fn main() {
mut a := []?u32{len: 0xFF}
if c := a[0] {
println('c: ${c} not none!')
}
}