From 2e45bfac0f00f608247a8eae17aee1bcea1fc260 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 29 Aug 2025 08:56:28 -0300 Subject: [PATCH] fix --- vlib/v/markused/walker.v | 3 +++ vlib/v/tests/options/option_map_val_test.v | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 vlib/v/tests/options/option_map_val_test.v diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index 5b30333789..a7a286a72b 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -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) diff --git a/vlib/v/tests/options/option_map_val_test.v b/vlib/v/tests/options/option_map_val_test.v new file mode 100644 index 0000000000..fb045bba90 --- /dev/null +++ b/vlib/v/tests/options/option_map_val_test.v @@ -0,0 +1,6 @@ +fn test_main() { + mut m := map[int]?u32{} + if c := m[0] { + println('c: ${c} not none!') + } +}