markused: fix option map value (fix #25186) (#25188)

This commit is contained in:
Felipe Pena 2025-08-29 09:32:57 -03:00 committed by GitHub
parent eaf005e29f
commit 214628a939
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -1183,6 +1183,9 @@ pub fn (mut w Walker) mark_by_sym(isym ast.TypeSymbol) {
w.mark_by_type(isym.info.key_type)
w.mark_by_type(isym.info.value_type)
w.features.used_maps++
if isym.info.value_type.has_flag(.option) {
w.used_option++
}
}
ast.Alias {
w.mark_by_type(isym.info.parent_type)

View file

@ -0,0 +1,6 @@
fn test_main() {
mut m := map[int]?u32{}
if c := m[0] {
println('c: ${c} not none!')
}
}