@@ -5576,7 +5576,7 @@ fn (mut c Checker) ensure_generic_type_specify_type_names(typ ast.Type, pos toke
55765576fn (mut c Checker) ensure_type_exists (typ ast.Type, pos token.Pos) bool {
55775577 if typ == 0 {
55785578 c.error ('unknown type' , pos)
5579- return false
5579+ return c.pref.is_vls
55805580 }
55815581 c.type_level++
55825582 defer {
@@ -5585,7 +5585,7 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
55855585 if c.type_level > type_level_cutoff_limit {
55865586 c.error ('checker: too many levels of Checker.ensure_type_exists calls: ${c.type_level} , probably due to a self referencing type' ,
55875587 pos)
5588- return false
5588+ return c.pref.is_vls
55895589 }
55905590 sym := c.table.sym (typ)
55915591 if ! c.is_builtin_mod && ! sym.is_pub && sym.mod != c.mod && sym.mod != 'main' {
@@ -5602,12 +5602,12 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
56025602 if fn_mod != '' && fn_mod != c.mod && fn_info.func.name != '' && ! fn_info.is_anon {
56035603 c.error ('function type `${fn_info.func.name} ` was declared as private to module `${fn_mod} `, so it can not be used inside module `${c.mod} `' ,
56045604 pos)
5605- return false
5605+ return c.pref.is_vls
56065606 }
56075607 } else if sym.mod != '' {
56085608 c.error ('${sym.kind} `${sym.name} ` was declared as private to module `${sym.mod} `, so it can not be used inside module `${c.mod} `' ,
56095609 pos)
5610- return false
5610+ return c.pref.is_vls
56115611 }
56125612 }
56135613 match sym.kind {
@@ -5621,7 +5621,7 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
56215621 if sym.language == .v {
56225622 c.error (util.new_suggestion (sym.name, c.table.known_type_names ()).say ('unknown type `${sym.name} `' ),
56235623 pos)
5624- return false
5624+ return c.pref.is_vls
56255625 } else if sym.language == .c {
56265626 if ! c.pref.translated && ! c.file.is_translated {
56275627 c.warn (util.new_suggestion (sym.name, c.table.known_type_names ()).say ('unknown type `${sym.name} ` (all virtual C types must be defined, this will be an error soon)' ),
@@ -5643,44 +5643,44 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
56435643 'unknown type `${sym.name} `.\n Did you mean `f64`?'
56445644 }
56455645 c.error (msg, pos)
5646- return false
5646+ return c.pref.is_vls
56475647 }
56485648 }
56495649 .function {
56505650 fn_info := sym.info as ast.FnType
56515651 if ! c.ensure_type_exists (fn_info.func.return_type, fn_info.func.return_type_pos) {
5652- return false
5652+ return c.pref.is_vls
56535653 }
56545654 for param in fn_info.func.params {
56555655 if ! c.ensure_type_exists (param.typ, param.type_pos) {
5656- return false
5656+ return c.pref.is_vls
56575657 }
56585658 }
56595659 }
56605660 .array {
56615661 if ! c.ensure_type_exists ((sym.info as ast.Array ).elem_type, pos) {
5662- return false
5662+ return c.pref.is_vls
56635663 }
56645664 }
56655665 .array_fixed {
56665666 if ! c.ensure_type_exists ((sym.info as ast.ArrayFixed ).elem_type, pos) {
5667- return false
5667+ return c.pref.is_vls
56685668 }
56695669 }
56705670 .map {
56715671 info := sym.info as ast.Map
56725672 if ! c.ensure_type_exists (info.key_type, pos) {
5673- return false
5673+ return c.pref.is_vls
56745674 }
56755675 if ! c.ensure_type_exists (info.value_type, pos) {
5676- return false
5676+ return c.pref.is_vls
56775677 }
56785678 }
56795679 .sum_type {
56805680 info := sym.info as ast.SumType
56815681 for concrete_typ in info.concrete_types {
56825682 if ! c.ensure_type_exists (concrete_typ, pos) {
5683- return false
5683+ return c.pref.is_vls
56845684 }
56855685 }
56865686 }
@@ -5690,7 +5690,7 @@ fn (mut c Checker) ensure_type_exists(typ ast.Type, pos token.Pos) bool {
56905690 ...pos
56915691 col: pos.col + 5
56925692 }) {
5693- return false
5693+ return c.pref.is_vls
56945694 }
56955695 }
56965696 }
0 commit comments