Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 8, 2024
1 parent 58afabb commit b5b43e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vlib/v/checker/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -2070,10 +2070,15 @@ fn (mut c Checker) check_type_sym_kind(name string, type_idx int, expected_kind

// checks if a type from another module is as expected and visible(`is_pub`)
fn (mut c Checker) check_type_and_visibility(name string, type_idx int, expected_kind &ast.Kind, pos &token.Pos) bool {
if !c.check_type_sym_kind(name, type_idx, expected_kind, pos) {
mut sym := c.table.sym_by_idx(type_idx)
if sym.kind == .alias {
parent_type := (sym.info as ast.Alias).parent_type
sym = c.table.sym(parent_type)
}
if sym.kind != expected_kind {
c.error('expected ${expected_kind}, but `${name}` is ${sym.kind}', pos)
return false
}
mut sym := c.table.sym_by_idx(type_idx)
if !sym.is_pub {
c.error('module `${sym.mod}` type `${sym.name}` is private', pos)
return false
Expand Down

0 comments on commit b5b43e6

Please sign in to comment.