Skip to content

Commit

Permalink
Update checker.v
Browse files Browse the repository at this point in the history
fix error "vlib/x/json2/decoder2/decode_sumtype.v:50:11: error: sum_type `Sum` was declared as private to module `main`, so it can not be used inside module `x.json2.decoder2`"

Assume type define in `main` can be used as generic type in other module.
  • Loading branch information
kbkpbot authored Jan 21, 2025
1 parent 9b9edfc commit b14eb45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -5294,7 +5294,8 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
}
sym := c.table.sym(typ)
if !c.is_builtin_mod && sym.kind in [.struct, .alias, .sum_type, .function]! && !sym.is_pub
&& sym.mod != c.mod && c.comptime.comptime_for_field_var == '' && !c.inside_recheck {
&& sym.mod != c.mod && sym.mod != 'main' && c.comptime.comptime_for_field_var == ''
&& !c.inside_recheck {
if sym.kind == .function {
fn_info := sym.info as ast.FnType
// hack: recover fn mod from func name
Expand Down

0 comments on commit b14eb45

Please sign in to comment.