From 6f0948e68e60a57764552e1633fa9487cfb537d5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 5 Jan 2025 19:00:33 +0200 Subject: [PATCH] fix compiler panic for `./v -cc gcc vlib/x/json2/tests/decode_map_test.v` --- vlib/v/markused/walker.v | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index e8a040fc2a6640..09d6644113299c 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -735,7 +735,17 @@ pub fn (mut w Walker) or_block(node ast.OrExpr) { } pub fn (mut w Walker) as_cast(node ast.AsCast) { - if node.typ.has_flag(.generic) || node.expr_type.has_flag(.generic) { + if node.typ == 0 { + return + } + if node.typ.has_flag(.generic) { + w.as_cast_type_names['some_generic_type'] = 'some_generic_name' + return + } + if node.expr_type == 0 { + return + } + if node.expr_type.has_flag(.generic) { w.as_cast_type_names['some_generic_type'] = 'some_generic_name' return }