V version: 0.1.30 fe0ded9
OS: Ubuntu Desktop 20.10
What did you do?
I ran v up
What did you expect to see?
Updating V...
Current V version:
V 0.1.30 fe0ded9, timestamp: 2020-12-01 08:07:07 +0200
What did you see instead?
Updating V...
V self compiling ...
cannot compile to `/home/joseph/Documents/v`:
vlib/v/table/table.v:268:24: error: unknown method: `v.table.TypeInfo.find_field`
266 | for {
267 | if mut ts.info is Struct {
268 | if field := ts.info.find_field(name) {
| ~~~~~~~~~~~~~~~~~
269 | return field
270 | }
vlib/v/table/table.v:269:12: error: cannot use `void` as type `v.table.Field` in return argument
267 | if mut ts.info is Struct {
268 | if field := ts.info.find_field(name) {
269 | return field
| ~~~~~
270 | }
271 | } else if mut ts.info is Aggregate {
vlib/v/table/table.v:272:24: error: unknown method: `v.table.TypeInfo.find_field`
270 | }
271 | } else if mut ts.info is Aggregate {
272 | if field := ts.info.find_field(name) {
| ~~~~~~~~~~~~~~~~~
273 | return field
274 | }
vlib/v/table/table.v:273:12: error: cannot use `void` as type `v.table.Field` in return argument
271 | } else if mut ts.info is Aggregate {
272 | if field := ts.info.find_field(name) {
273 | return field
| ~~~~~
274 | }
275 | field := t.register_aggregate_field(mut ts, name) or {
vlib/v/checker/checker.v:362:34: error: `v.table.TypeInfo` is not a struct
360 | if field.is_embed {
361 | if mut sym.info is table.Struct {
362 | for embed_field in sym.info.fields {
| ~~~~~~
363 | already_exists := struct_sym.info.fields.filter(it.name == embed_field.name).len >
364 | 0
vlib/v/checker/checker.v:363:41: error: `v.table.TypeInfo` is not a struct
361 | if mut sym.info is table.Struct {
362 | for embed_field in sym.info.fields {
363 | already_exists := struct_sym.info.fields.filter(it.name == embed_field.name).len >
| ~~~~~~
364 | 0
365 | if !already_exists {
vlib/v/checker/checker.v:365:10: error: ! operator can only be used with bool types
363 | already_exists := struct_sym.info.fields.filter(it.name == embed_field.name).len >
364 | 0
365 | if !already_exists {
| ^
366 | struct_sym.info.fields << {
367 | embed_field |
vlib/v/checker/checker.v:366:24: error: `v.table.TypeInfo` is not a struct
364 | 0
365 | if !already_exists {
366 | struct_sym.info.fields << {
| ~~~~~~
367 | embed_field |
368 | embed_alias_for: field.name
vlib/v/checker/checker.v:423:28: error: `v.ast.Expr` is not a struct
421 | }
422 | if field.default_expr is ast.IntegerLiteral {
423 | if field.default_expr.val == '0' {
| ~~~
424 | c.warn('unnecessary default value of `0`: struct fields are zeroed by default',
425 | field.default_expr.pos)
vlib/v/checker/checker.v:425:27: error: `v.ast.Expr` is not a struct
423 | if field.default_expr.val == '0' {
424 | c.warn('unnecessary default value of `0`: struct fields are zeroed by default',
425 | field.default_expr.pos)
| ~~~
426 | }
427 | } else if field.default_expr is ast.StringLiteral {
vlib/v/checker/checker.v:428:28: error: `v.ast.Expr` is not a struct
426 | }
427 | } else if field.default_expr is ast.StringLiteral {
428 | if field.default_expr.val == '' {
| ~~~
429 | c.warn("unnecessary default value of '': struct fields are zeroed by default",
430 | field.default_expr.pos)
vlib/v/checker/checker.v:430:27: error: `v.ast.Expr` is not a struct
428 | if field.default_expr.val == '' {
429 | c.warn("unnecessary default value of '': struct fields are zeroed by default",
430 | field.default_expr.pos)
| ~~~
431 | }
432 | } else if field.default_expr is ast.BoolLiteral {
vlib/v/checker/checker.v:433:28: error: `v.ast.Expr` is not a struct
431 | }
432 | } else if field.default_expr is ast.BoolLiteral {
433 | if field.default_expr.val == false {
| ~~~
434 | c.warn('unnecessary default value `false`: struct fields are zeroed by default',
435 | field.default_expr.pos)
vlib/v/checker/checker.v:435:27: error: `v.ast.Expr` is not a struct
433 | if field.default_expr.val == false {
434 | c.warn('unnecessary default value `false`: struct fields are zeroed by default',
435 | field.default_expr.pos)
| ~~~
436 | }
437 | }
vlib/v/checker/checker.v:641:24: error: `v.ast.Expr` is not a struct
639 | match mut infix_expr.left {
640 | ast.Ident, ast.SelectorExpr {
641 | if infix_expr.left.is_mut {
| ~~~~~~
642 | c.error('remove unnecessary `mut`', infix_expr.left.mut_pos)
643 | }
vlib/v/checker/checker.v:642:58: error: `v.ast.Expr` is not a struct
640 | ast.Ident, ast.SelectorExpr {
641 | if infix_expr.left.is_mut {
642 | c.error('remove unnecessary `mut`', infix_expr.left.mut_pos)
| ~~~~~~~
643 | }
644 | }
vlib/v/checker/checker.v:761:28: error: `v.ast.Expr` is not a struct
759 | match mut infix_expr.right {
760 | ast.FloatLiteral {
761 | if infix_expr.right.val.f64() == 0.0 {
| ~~~
762 | oper := if infix_expr.op == .div { 'division' } else { 'modulo' }
763 | c.error('$oper by zero', infix_expr.right.pos)
vlib/v/checker/checker.v:763:51: error: `v.ast.Expr` is not a struct
761 | if infix_expr.right.val.f64() == 0.0 {
762 | oper := if infix_expr.op == .div { 'division' } else { 'modulo' }
763 | c.error('$oper by zero', infix_expr.right.pos)
| ~~~
764 | }
765 | }
vlib/v/checker/checker.v:767:28: error: `v.ast.Expr` is not a struct
765 | }
766 | ast.IntegerLiteral {
767 | if infix_expr.right.val.int() == 0 {
| ~~~
768 | oper := if infix_expr.op == .div { 'division' } else { 'modulo' }
769 | c.error('$oper by zero', infix_expr.right.pos)
vlib/v/checker/checker.v:769:51: error: `v.ast.Expr` is not a struct
767 | if infix_expr.right.val.int() == 0 {
768 | oper := if infix_expr.op == .div { 'division' } else { 'modulo' }
769 | c.error('$oper by zero', infix_expr.right.pos)
| ~~~
770 | }
771 | }
vlib/v/checker/checker.v:830:36: error: `v.table.TypeInfo` is not a struct
828 | infix_expr.pos)
829 | } else if mut left.info is table.SumType {
830 | if type_expr.typ !in left.info.variants {
| ~~~~~~~~
831 | c.error('`$left.source_name` has no variant `$right.source_name`',
832 | infix_expr.pos)
vlib/v/checker/checker.v:867:24: error: `v.ast.Expr` is not a struct
865 | // for example: `(a && b) || c` instead of `a && b || c`
866 | if mut infix_expr.left is ast.InfixExpr {
867 | if infix_expr.left.op != infix_expr.op && infix_expr.left.op in [.logical_or, .and] {
| ~~
868 | c.error('use `()` to make the boolean expression clear', infix_expr.pos)
869 | }
vlib/v/checker/checker.v:959:52: error: `v.table.TypeInfo` is not a struct
957 | mut typ_sym := c.table.get_type_symbol(c.unwrap_generic(expr.expr_type))
958 | if mut typ_sym.info is table.Alias {
959 | typ_sym = c.table.get_type_symbol(typ_sym.info.parent_type)
| ~~~~~~~~~~~
960 | }
961 | match typ_sym.kind {
vlib/v/checker/checker.v:1169:44: error: `v.table.TypeInfo` is not a struct
1167 | mut ret_type := 0
1168 | match mut arg_sym.info {
1169 | table.FnType { ret_type = arg_sym.info.func.return_type }
| ~~~~
1170 | else { ret_type = arg_type }
1171 | }
vlib/v/checker/checker.v:1413:57: error: `v.ast.Expr` is not a struct
1411 | call_expr.name = ''
1412 | c.expr(call_expr.left)
1413 | anon_fn_sym := c.table.get_type_symbol(call_expr.left.typ)
| ~~~
1414 | f = (anon_fn_sym.info as table.FnType).func
1415 | found = true
vlib/v/checker/checker.v:1649:29: error: `v.table.TypeInfo` is not a struct
1647 | }
1648 | if mut inter_sym.info is table.Interface {
1649 | if typ !in inter_sym.info.types && typ_sym.kind != .interface_ {
| ~~~~~
1650 | inter_sym.info.types << typ
1651 | }
vlib/v/checker/checker.v:1650:19: error: `v.table.TypeInfo` is not a struct
1648 | if mut inter_sym.info is table.Interface {
1649 | if typ !in inter_sym.info.types && typ_sym.kind != .interface_ {
1650 | inter_sym.info.types << typ
| ~~~~~
1651 | }
1652 | }
vlib/v/checker/checker.v:1774:26: error: `v.ast.Expr` is not a struct
1772 | match mut selector_expr.expr {
1773 | ast.Ident {
1774 | if selector_expr.expr.name == 'T' {
| ~~~~
1775 | name_type = table.Type(c.table.find_type_idx('T')).set_flag(.generic)
1776 | }
vlib/v/checker/checker.v:1781:42: error: `v.ast.Expr` is not a struct
1779 | // sum types should not be handled dynamically
1780 | ast.TypeOf {
1781 | name_type = c.expr(selector_expr.expr.expr)
| ~~~~
1782 | }
1783 | else {}
vlib/v/checker/checker.v:1975:24: error: `v.ast.Expr` is not a struct
1973 | match field.expr {
1974 | ast.IntegerLiteral {
1975 | val := field.expr.val.i64()
| ~~~
1976 | if val < int_min || val > int_max {
1977 | c.error('enum value `$val` overflows int', field.expr.pos)
vlib/v/checker/checker.v:1976:9: error: left operand for `||` is not a boolean
1974 | ast.IntegerLiteral {
1975 | val := field.expr.val.i64()
1976 | if val < int_min || val > int_max {
| ~~~~~~~~~~~~~
1977 | c.error('enum value `$val` overflows int', field.expr.pos)
1978 | } else if !decl.is_multi_allowed && int(val) in seen {
vlib/v/checker/checker.v:1977:61: error: `v.ast.Expr` is not a struct
1975 | val := field.expr.val.i64()
1976 | if val < int_min || val > int_max {
1977 | c.error('enum value `$val` overflows int', field.expr.pos)
| ~~~
1978 | } else if !decl.is_multi_allowed && int(val) in seen {
1979 | c.error('enum value `$val` already exists', field.expr.pos)
vlib/v/checker/checker.v:1979:62: error: `v.ast.Expr` is not a struct
1977 | c.error('enum value `$val` overflows int', field.expr.pos)
1978 | } else if !decl.is_multi_allowed && int(val) in seen {
1979 | c.error('enum value `$val` already exists', field.expr.pos)
| ~~~
1980 | }
1981 | seen << int(val)
vlib/v/checker/checker.v:1986:21: error: `v.ast.Expr` is not a struct
1984 | else {
1985 | if field.expr is ast.Ident {
1986 | if field.expr.language == .c {
| ~~~~~~~~
1987 | continue
1988 | }
vlib/v/checker/checker.v:2050:39: error: `v.ast.Expr` is not a struct
2048 | if node.right is ast.Ident {
2049 | scope := c.file.scope.innermost(node.pos.pos)
2050 | if v := scope.find_var(node.right.name) {
| ~~~~
2051 | right_type0 = v.typ
2052 | if node.op == .amp {
vlib/v/checker/checker.v:2054:30: error: `v.ast.Expr` is not a struct
2052 | if node.op == .amp {
2053 | if !v.is_mut && assigned_var.is_mut && !c.inside_unsafe {
2054 | c.error('`$node.right.name` is immutable, cannot have a mutable reference to it',
| ~~~~
2055 | node.pos)
2056 | }
vlib/v/checker/checker.v:2159:27: error: `v.ast.ScopeObject` is not a struct
2157 | if left_type != 0 {
2158 | match mut left.obj {
2159 | ast.Var { left.obj.typ = left_type }
| ~~~
2160 | ast.GlobalField { left.obj.typ = left_type }
2161 | else {}
vlib/v/checker/checker.v:2160:35: error: `v.ast.ScopeObject` is not a struct
2158 | match mut left.obj {
2159 | ast.Var { left.obj.typ = left_type }
2160 | ast.GlobalField { left.obj.typ = left_type }
| ~~~
2161 | else {}
2162 | }
vlib/v/checker/checker.v:2633:31: error: `v.ast.Expr` is not a struct
2631 | if mut node.call_expr is ast.CallExpr {
2632 | // Make sure there are no mutable arguments
2633 | for arg in node.call_expr.args {
| ~~~~
2634 | if arg.is_mut && !arg.typ.is_ptr() {
2635 | c.error('function in `go` statement cannot contain mutable non-reference arguments',
vlib/v/checker/checker.v:2634:13: error: unknown selector expression
2632 | // Make sure there are no mutable arguments
2633 | for arg in node.call_expr.args {
2634 | if arg.is_mut && !arg.typ.is_ptr() {
| ~~~~~~
2635 | c.error('function in `go` statement cannot contain mutable non-reference arguments',
2636 | arg.expr.position())
vlib/v/checker/checker.v:2636:12: error: unknown selector expression
2634 | if arg.is_mut && !arg.typ.is_ptr() {
2635 | c.error('function in `go` statement cannot contain mutable non-reference arguments',
2636 | arg.expr.position())
| ~~~~
2637 | }
2638 | }
vlib/v/checker/checker.v:2639:23: error: `v.ast.Expr` is not a struct
2637 | }
2638 | }
2639 | if node.call_expr.is_method && node.call_expr.receiver_type.is_ptr() && !node.call_expr.left_type.is_ptr() {
| ~~~~~~~~~
2640 | c.error('method in `go` statement cannot have non-reference mutable receiver',
2641 | node.call_expr.left.position())
vlib/v/checker/checker.v:2641:22: error: `v.ast.Expr` is not a struct
2639 | if node.call_expr.is_method && node.call_expr.receiver_type.is_ptr() && !node.call_expr.left_type.is_ptr() {
2640 | c.error('method in `go` statement cannot have non-reference mutable receiver',
2641 | node.call_expr.left.position())
| ~~~~
2642 | }
2643 | }
vlib/v/checker/checker.v:2967:52: error: `v.ast.Expr` is not a struct
2965 | }
2966 | if mut node.right is ast.IndexExpr {
2967 | typ_sym := c.table.get_type_symbol(node.right.left_type)
| ~~~~~~~~~
2968 | mut is_mut := false
2969 | if mut node.right.left is ast.Ident {
vlib/v/checker/checker.v:2969:24: error: `v.ast.Expr` is not a struct
2967 | typ_sym := c.table.get_type_symbol(node.right.left_type)
2968 | mut is_mut := false
2969 | if mut node.right.left is ast.Ident {
| ~~~~
2970 | ident := node.right.left
2971 | if ident.obj is ast.Var {
vlib/v/checker/checker.v:2970:27: error: `v.ast.Expr` is not a struct
2968 | mut is_mut := false
2969 | if mut node.right.left is ast.Ident {
2970 | ident := node.right.left
| ~~~~
2971 | if ident.obj is ast.Var {
2972 | v := ident.obj as ast.Var
vlib/v/checker/checker.v:2971:16: error: unknown selector expression
2969 | if mut node.right.left is ast.Ident {
2970 | ident := node.right.left
2971 | if ident.obj is ast.Var {
| ~~~
2972 | v := ident.obj as ast.Var
2973 | is_mut = v.is_mut
vlib/v/checker/checker.v:2972:19: error: unknown selector expression
2970 | ident := node.right.left
2971 | if ident.obj is ast.Var {
2972 | v := ident.obj as ast.Var
| ~~~
2973 | is_mut = v.is_mut
2974 | }
vlib/v/checker/checker.v:2979:20: error: `v.ast.Expr` is not a struct
2977 | if typ_sym.kind == .map {
2978 | c.error('cannot take the address of mutable map values outside unsafe blocks',
2979 | node.right.pos)
| ~~~
2980 | }
2981 | if typ_sym.kind == .array {
vlib/v/checker/checker.v:2983:20: error: `v.ast.Expr` is not a struct
2981 | if typ_sym.kind == .array {
2982 | c.error('cannot take the address of mutable array elements outside unsafe blocks',
2983 | node.right.pos)
| ~~~
2984 | }
2985 | }
vlib/v/checker/checker.v:3109:54: error: `v.table.TypeInfo` is not a struct
3107 | }
3108 | } else if mut to_type_sym.info is table.Alias {
3109 | if !c.check_types(node.expr_type, to_type_sym.info.parent_type) {
| ~~~~~~~~~~~
3110 | parent_type_sym := c.table.get_type_symbol(to_type_sym.info.parent_type)
3111 | c.error('cannot convert type `$from_type_sym.source_name` to `$to_type_sym.source_name` (alias to `$parent_type_sym.source_name`)',
vlib/v/checker/checker.v:3110:64: error: `v.table.TypeInfo` is not a struct
3108 | } else if mut to_type_sym.info is table.Alias {
3109 | if !c.check_types(node.expr_type, to_type_sym.info.parent_type) {
3110 | parent_type_sym := c.table.get_type_symbol(to_type_sym.info.parent_type)
| ~~~~~~~~~~~
3111 | c.error('cannot convert type `$from_type_sym.source_name` to `$to_type_sym.source_name` (alias to `$parent_type_sym.source_name`)',
3112 | node.pos)
vlib/v/checker/checker.v:3123:18: error: `v.ast.Expr` is not a struct
3121 | mut error_msg := 'cannot cast a string'
3122 | if mut node.expr is ast.StringLiteral {
3123 | if node.expr.val.len == 1 {
| ~~~
3124 | error_msg += ", for denoting characters use `$node.expr.val` instead of '$node.expr.val'"
3125 | }
vlib/v/checker/checker.v:3124:62: error: `v.ast.Expr` is not a struct
3122 | if mut node.expr is ast.StringLiteral {
3123 | if node.expr.val.len == 1 {
3124 | error_msg += ", for denoting characters use `$node.expr.val` instead of '$node.expr.val'"
| ~~~
3125 | }
3126 | }
vlib/v/checker/checker.v:3276:20: error: `v.ast.Expr` is not a struct
3274 | if typ == 0 {
3275 | if mut obj.expr is ast.Ident {
3276 | if obj.expr.kind == .unresolved {
| ~~~~
3277 | c.error('unresolved variable: `$ident.name`', ident.pos)
3278 | return table.void_type
vlib/v/checker/checker.v:3284:45: error: `v.ast.Expr` is not a struct
3282 | // new variable from if guard shouldn't have the optional flag for further use
3283 | // a temp variable will be generated which unwraps it
3284 | if_guard_var_type := c.expr(obj.expr.expr)
| ~~~~
3285 | typ = if_guard_var_type.clear_flag(.optional)
3286 | } else {
vlib/v/checker/checker.v:3547:41: error: `v.table.TypeInfo` is not a struct
3545 | c.type_implements(expr_type, c.expected_type, expr_pos)
3546 | } else if mut cond_type_sym.info is table.SumType {
3547 | if expr_type !in cond_type_sym.info.variants {
| ~~~~~~~~
3548 | expr_str := c.table.type_to_str(expr_type)
3549 | expect_str := c.table.type_to_str(c.expected_type)
vlib/v/checker/checker.v:3597:53: error: `v.ast.Expr` is not a struct
3595 | mut is_mut := false
3596 | mut sum_type_casts := []table.Type{}
3597 | expr_sym := c.table.get_type_symbol(node.cond.expr_type)
| ~~~~~~~~~
3598 | if field := c.table.struct_find_field(expr_sym, node.cond.field_name) {
3599 | is_mut = field.is_mut
vlib/v/checker/checker.v:3598:65: error: `v.ast.Expr` is not a struct
3596 | mut sum_type_casts := []table.Type{}
3597 | expr_sym := c.table.get_type_symbol(node.cond.expr_type)
3598 | if field := c.table.struct_find_field(expr_sym, node.cond.field_name) {
| ~~~~~~~~~~
3599 | is_mut = field.is_mut
3600 | }
vlib/v/checker/checker.v:3601:53: error: `v.ast.Expr` is not a struct
3599 | is_mut = field.is_mut
3600 | }
3601 | if field := scope.find_struct_field(node.cond.expr_type, node.cond.field_name) {
| ~~~~~~~~~
3602 | sum_type_casts << field.sum_type_casts
3603 | }
vlib/v/checker/checker.v:3605:31: error: `v.ast.Expr` is not a struct
3603 | }
3604 | // smartcast either if the value is immutable or if the mut argument is explicitly given
3605 | if !is_mut || node.cond.is_mut {
| ~~~~~~
3606 | sum_type_casts << expr_type
3607 | scope.register_struct_field(ast.ScopeStructField{
vlib/v/checker/checker.v:3608:32: error: `v.ast.Expr` is not a struct
3606 | sum_type_casts << expr_type
3607 | scope.register_struct_field(ast.ScopeStructField{
3608 | struct_type: node.cond.expr_type
| ~~~~~~~~~
3609 | name: node.cond.field_name
3610 | typ: node.cond_type
vlib/v/checker/checker.v:3609:25: error: `v.ast.Expr` is not a struct
3607 | scope.register_struct_field(ast.ScopeStructField{
3608 | struct_type: node.cond.expr_type
3609 | name: node.cond.field_name
| ~~~~~~~~~~
3610 | typ: node.cond_type
3611 | sum_type_casts: sum_type_casts
vlib/v/checker/checker.v:3612:24: error: `v.ast.Expr` is not a struct
3610 | typ: node.cond_type
3611 | sum_type_casts: sum_type_casts
3612 | pos: node.cond.pos
| ~~~
3613 | })
3614 | }
vlib/v/checker/checker.v:3620:40: error: `v.ast.Expr` is not a struct
3618 | mut sum_type_casts := []table.Type{}
3619 | mut is_already_casted := false
3620 | if v := scope.find_var(node.cond.name) {
| ~~~~
3621 | is_mut = v.is_mut
3622 | sum_type_casts << v.sum_type_casts
vlib/v/checker/checker.v:3623:51: error: `v.ast.Expr` is not a struct
3621 | is_mut = v.is_mut
3622 | sum_type_casts << v.sum_type_casts
3623 | is_already_casted = v.pos.pos == node.cond.pos.pos
| ~~~
3624 | }
3625 | // smartcast either if the value is immutable or if the mut argument is explicitly given
vlib/v/checker/checker.v:3626:32: error: `v.ast.Expr` is not a struct
3624 | }
3625 | // smartcast either if the value is immutable or if the mut argument is explicitly given
3626 | if (!is_mut || node.cond.is_mut) && !is_already_casted {
| ~~~~~~
3627 | sum_type_casts << expr_type
3628 | scope.register(node.cond.name, ast.Var{
vlib/v/checker/checker.v:1:1: error: left operand for `&&` is not a boolean
1 | // Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
| ^
2 | // Use of this source code is governed by an MIT license that can be found in the LICENSE file.
3 | module checker
vlib/v/checker/checker.v:3628:33: error: `v.ast.Expr` is not a struct
3626 | if (!is_mut || node.cond.is_mut) && !is_already_casted {
3627 | sum_type_casts << expr_type
3628 | scope.register(node.cond.name, ast.Var{
| ~~~~
3629 | name: node.cond.name
3630 | typ: node.cond_type
vlib/v/checker/checker.v:3629:25: error: `v.ast.Expr` is not a struct
3627 | sum_type_casts << expr_type
3628 | scope.register(node.cond.name, ast.Var{
3629 | name: node.cond.name
| ~~~~
3630 | typ: node.cond_type
3631 | pos: node.cond.pos
vlib/v/checker/checker.v:3631:24: error: `v.ast.Expr` is not a struct
3629 | name: node.cond.name
3630 | typ: node.cond_type
3631 | pos: node.cond.pos
| ~~~
3632 | is_used: true
3633 | is_mut: node.cond.is_mut
vlib/v/checker/checker.v:3633:27: error: `v.ast.Expr` is not a struct
3631 | pos: node.cond.pos
3632 | is_used: true
3633 | is_mut: node.cond.is_mut
| ~~~~~~
3634 | sum_type_casts: sum_type_casts
3635 | })
vlib/v/checker/checker.v:3651:27: error: `v.table.TypeInfo` is not a struct
3649 | match mut type_sym.info {
3650 | table.SumType {
3651 | for v in type_sym.info.variants {
| ~~~~~~~~
3652 | v_str := c.table.type_to_str(v)
3653 | if v_str !in branch_exprs {
vlib/v/checker/checker.v:3661:27: error: `v.table.TypeInfo` is not a struct
3659 | //
3660 | table.Enum {
3661 | for v in type_sym.info.vals {
| ~~~~
3662 | if v !in branch_exprs {
3663 | is_exhaustive = false
vlib/v/checker/checker.v:3662:10: error: left operand to `!in` does not match the map key type: expected `string`, not `void`
3660 | table.Enum {
3661 | for v in type_sym.info.vals {
3662 | if v !in branch_exprs {
| ~~~
3663 | is_exhaustive = false
3664 | unhandled << '`.$v`'
vlib/v/checker/checker.v:3717:22: error: `v.ast.Stmt` is not a struct
3715 | ast.ExprStmt {
3716 | if branch.is_timeout {
3717 | if !branch.stmt.typ.is_int() {
| ~~~
3718 | tsym := c.table.get_type_symbol(branch.stmt.typ)
3719 | c.error('invalid type `$tsym.name` for timeout - expected integer type aka `time.Duration`',
vlib/v/checker/checker.v:3718:51: error: `v.ast.Stmt` is not a struct
3716 | if branch.is_timeout {
3717 | if !branch.stmt.typ.is_int() {
3718 | tsym := c.table.get_type_symbol(branch.stmt.typ)
| ~~~
3719 | c.error('invalid type `$tsym.name` for timeout - expected integer type aka `time.Duration`',
3720 | branch.stmt.pos)
vlib/v/checker/checker.v:3720:20: error: `v.ast.Stmt` is not a struct
3718 | tsym := c.table.get_type_symbol(branch.stmt.typ)
3719 | c.error('invalid type `$tsym.name` for timeout - expected integer type aka `time.Duration`',
3720 | branch.stmt.pos)
| ~~~
3721 | }
3722 | } else {
vlib/v/checker/checker.v:3723:21: error: `v.ast.Stmt` is not a struct
3721 | }
3722 | } else {
3723 | if branch.stmt.expr is ast.InfixExpr {
| ~~~~
3724 | if branch.stmt.expr.left !is ast.Ident &&
3725 | branch.stmt.expr.left !is ast.SelectorExpr && branch.stmt.expr.left !is ast.IndexExpr {
vlib/v/checker/checker.v:3724:22: error: `v.ast.Stmt` is not a struct
3722 | } else {
3723 | if branch.stmt.expr is ast.InfixExpr {
3724 | if branch.stmt.expr.left !is ast.Ident &&
| ~~~~
3725 | branch.stmt.expr.left !is ast.SelectorExpr && branch.stmt.expr.left !is ast.IndexExpr {
3726 | c.error('channel in `select` key must be predefined', branch.stmt.expr.left.position())
vlib/v/checker/checker.v:3725:20: error: `v.ast.Stmt` is not a struct
3723 | if branch.stmt.expr is ast.InfixExpr {
3724 | if branch.stmt.expr.left !is ast.Ident &&
3725 | branch.stmt.expr.left !is ast.SelectorExpr && branch.stmt.expr.left !is ast.IndexExpr {
| ~~~~
3726 | c.error('channel in `select` key must be predefined', branch.stmt.expr.left.position())
3727 | }
vlib/v/checker/checker.v:3726:74: error: `v.ast.Stmt` is not a struct
3724 | if branch.stmt.expr.left !is ast.Ident &&
3725 | branch.stmt.expr.left !is ast.SelectorExpr && branch.stmt.expr.left !is ast.IndexExpr {
3726 | c.error('channel in `select` key must be predefined', branch.stmt.expr.left.position())
| ~~~~
3727 | }
3728 | } else {
vlib/v/checker/checker.v:3729:66: error: `v.ast.Stmt` is not a struct
3727 | }
3728 | } else {
3729 | c.error('invalid expression for `select` key', branch.stmt.expr.position())
| ~~~~
3730 | }
3731 | }
vlib/v/checker/checker.v:3734:25: error: `v.ast.Stmt` is not a struct
3732 | }
3733 | ast.AssignStmt {
3734 | expr := branch.stmt.right[0]
| ~~~~~
3735 | match expr {
3736 | ast.PrefixExpr {
vlib/v/checker/checker.v:3736:6: error: cannot match `ast.PrefixExpr` with `void` condition
3734 | expr := branch.stmt.right[0]
3735 | match expr {
3736 | ast.PrefixExpr {
| ~~~~~~~~~~~~~~~~
3737 | if expr.right !is ast.Ident &&
3738 | expr.right !is ast.SelectorExpr && expr.right !is ast.IndexExpr {
vlib/v/checker/checker.v:3747:63: error: `v.ast.Stmt` is not a struct
3745 | }
3746 | else {
3747 | c.error('`<-` receive expression expected', branch.stmt.right[0].position())
| ~~~~~
3748 | }
3749 | }
vlib/v/checker/checker.v:3767:14: error: `v.ast.ScopeObject` is not a struct
3765 | id := node.lockeds[i]
3766 | if mut id.obj is ast.Var {
3767 | if id.obj.typ.share() != .shared_t {
| ~~~
3768 | c.error('`$id.name` must be declared `shared` to be locked', id.pos)
3769 | }
vlib/v/checker/checker.v:3850:65: error: `v.ast.Expr` is not a struct
3848 | infix.left is ast.SelectorExpr) &&
3849 | infix.right is ast.Type {
3850 | is_variable := if mut infix.left is ast.Ident { infix.left.kind == .variable } else { true }
| ~~~~
3851 | // Register shadow variable or `as` variable with actual type
3852 | if is_variable {
vlib/v/checker/checker.v:3858:43: error: `v.ast.Expr` is not a struct
3856 | if mut infix.left is ast.Ident {
3857 | mut sum_type_casts := []table.Type{}
3858 | if v := scope.find_var(infix.left.name) {
| ~~~~
3859 | is_mut = v.is_mut
3860 | sum_type_casts << v.sum_type_casts
vlib/v/checker/checker.v:3864:35: error: `v.ast.Expr` is not a struct
3862 | if left_sym.kind == .sum_type {
3863 | // smartcast either if the value is immutable or if the mut argument is explicitly given
3864 | if !is_mut || infix.left.is_mut {
| ~~~~~~
3865 | sum_type_casts << right_expr.typ
3866 | scope.register(infix.left.name, ast.Var{
vlib/v/checker/checker.v:3866:37: error: `v.ast.Expr` is not a struct
3864 | if !is_mut || infix.left.is_mut {
3865 | sum_type_casts << right_expr.typ
3866 | scope.register(infix.left.name, ast.Var{
| ~~~~
3867 | name: infix.left.name
3868 | typ: infix.left_type
vlib/v/checker/checker.v:3867:29: error: `v.ast.Expr` is not a struct
3865 | sum_type_casts << right_expr.typ
3866 | scope.register(infix.left.name, ast.Var{
3867 | name: infix.left.name
| ~~~~
3868 | typ: infix.left_type
3869 | sum_type_casts: sum_type_casts
vlib/v/checker/checker.v:3870:28: error: `v.ast.Expr` is not a struct
3868 | typ: infix.left_type
3869 | sum_type_casts: sum_type_casts
3870 | pos: infix.left.pos
| ~~~
3871 | is_used: true
3872 | is_mut: is_mut
vlib/v/checker/checker.v:3876:36: error: `v.ast.Expr` is not a struct
3874 | }
3875 | } else if left_sym.kind == .interface_ {
3876 | scope.register(infix.left.name, ast.Var{
| ~~~~
3877 | name: infix.left.name
3878 | typ: right_expr.typ.to_ptr()
vlib/v/checker/checker.v:3877:28: error: `v.ast.Expr` is not a struct
3875 | } else if left_sym.kind == .interface_ {
3876 | scope.register(infix.left.name, ast.Var{
3877 | name: infix.left.name
| ~~~~
3878 | typ: right_expr.typ.to_ptr()
3879 | sum_type_casts: sum_type_casts
vlib/v/checker/checker.v:3880:27: error: `v.ast.Expr` is not a struct
3878 | typ: right_expr.typ.to_ptr()
3879 | sum_type_casts: sum_type_casts
3880 | pos: infix.left.pos
| ~~~
3881 | is_used: true
3882 | is_mut: is_mut
vlib/v/checker/checker.v:3889:56: error: `v.ast.Expr` is not a struct
3887 | } else if mut infix.left is ast.SelectorExpr {
3888 | mut sum_type_casts := []table.Type{}
3889 | expr_sym := c.table.get_type_symbol(infix.left.expr_type)
| ~~~~~~~~~
3890 | if field := c.table.struct_find_field(expr_sym, infix.left.field_name) {
3891 | is_mut = field.is_mut
vlib/v/checker/checker.v:3890:68: error: `v.ast.Expr` is not a struct
3888 | mut sum_type_casts := []table.Type{}
3889 | expr_sym := c.table.get_type_symbol(infix.left.expr_type)
3890 | if field := c.table.struct_find_field(expr_sym, infix.left.field_name) {
| ~~~~~~~~~~
3891 | is_mut = field.is_mut
3892 | }
vlib/v/checker/checker.v:3893:56: error: `v.ast.Expr` is not a struct
3891 | is_mut = field.is_mut
3892 | }
3893 | if field := scope.find_struct_field(infix.left.expr_type,
| ~~~~~~~~~
3894 | infix.left.field_name) {
3895 | sum_type_casts << field.sum_type_casts
vlib/v/checker/checker.v:3894:21: error: `v.ast.Expr` is not a struct
3892 | }
3893 | if field := scope.find_struct_field(infix.left.expr_type,
3894 | infix.left.field_name) {
| ~~~~~~~~~~
3895 | sum_type_casts << field.sum_type_casts
3896 | }
vlib/v/checker/checker.v:3898:35: error: `v.ast.Expr` is not a struct
3896 | }
3897 | // smartcast either if the value is immutable or if the mut argument is explicitly given
3898 | if (!is_mut || infix.left.is_mut) && left_sym.kind == .sum_type {
| ~~~~~~
3899 | sum_type_casts << right_expr.typ
3900 | scope.register_struct_field(ast.ScopeStructField{
vlib/v/checker/checker.v:3901:35: error: `v.ast.Expr` is not a struct
3899 | sum_type_casts << right_expr.typ
3900 | scope.register_struct_field(ast.ScopeStructField{
3901 | struct_type: infix.left.expr_type
| ~~~~~~~~~
3902 | name: infix.left.field_name
3903 | typ: infix.left_type
V panic: get_type_symbol: invalid type (typ=0 idx=0). Compiler bug. This should never happen. Please create a GitHub issue.
| 0x560393e1798d | /home/joseph/Documents/v/v(+0x4498d)
| 0x560393e959ff | /home/joseph/Documents/v/v(+0xc29ff)
| 0x560393e957f7 | /home/joseph/Documents/v/v(+0xc27f7)
| 0x560393e76d5e | /home/joseph/Documents/v/v(+0xa3d5e)
| 0x560393e7f0da | /home/joseph/Documents/v/v(+0xac0da)
| 0x560393e7788f | /home/joseph/Documents/v/v(+0xa488f)
| 0x560393e6e512 | /home/joseph/Documents/v/v(+0x9b512)
| 0x560393e6d9c9 | /home/joseph/Documents/v/v(+0x9a9c9)
| 0x560393e6d8ae | /home/joseph/Documents/v/v(+0x9a8ae)
| 0x560393e7f477 | /home/joseph/Documents/v/v(+0xac477)
| 0x560393e7788f | /home/joseph/Documents/v/v(+0xa488f)
| 0x560393e6e512 | /home/joseph/Documents/v/v(+0x9b512)
| 0x560393e6d9c9 | /home/joseph/Documents/v/v(+0x9a9c9)
| 0x560393e6d8ae | /home/joseph/Documents/v/v(+0x9a8ae)
| 0x560393e6ef7e | /home/joseph/Documents/v/v(+0x9bf7e)
| 0x560393e6d9c9 | /home/joseph/Documents/v/v(+0x9a9c9)
| 0x560393e6d8ae | /home/joseph/Documents/v/v(+0x9a8ae)
| 0x560393e945ac | /home/joseph/Documents/v/v(+0xc15ac)
| 0x560393e6e9b9 | /home/joseph/Documents/v/v(+0x9b9b9)
| 0x560393e6d9c9 | /home/joseph/Documents/v/v(+0x9a9c9)
| 0x560393e6d8ae | /home/joseph/Documents/v/v(+0x9a8ae)
| 0x560393e6a191 | /home/joseph/Documents/v/v(+0x97191)
| 0x560393eb2ae9 | /home/joseph/Documents/v/v(+0xdfae9)
| 0x560393eb2c72 | /home/joseph/Documents/v/v(+0xdfc72)
| 0x560393eb2fb9 | /home/joseph/Documents/v/v(+0xdffb9)
| 0x560393eb912e | /home/joseph/Documents/v/v(+0xe612e)
| 0x560393ebefd6 | /home/joseph/Documents/v/v(+0xebfd6)
| 0x560393ec9bc3 | /home/joseph/Documents/v/v(+0xf6bc3)
| 0x7f1e360c0cb2 | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf2)
| 0x560393dd5a6e | /home/joseph/Documents/v/v(+0x2a6e)
Segmentation fault (core dumped)
`"/home/joseph/Documents/v/v" self` failed, running `make`...
cd ./vc && git clean -xf && git pull --quiet
make fresh_tcc
make[1]: Entering directory '/home/joseph/Documents/v'
rm -rf /var/tmp/tcc
git clone https://github.com/vlang/tccbin /var/tmp/tcc
Cloning into '/var/tmp/tcc'...
rm -rf ./thirdparty/tcc
git clone --depth 1 --quiet --single-branch --branch thirdparty-linux-amd64 https://github.com/vlang/tccbin ./thirdparty/tcc
make[1]: Leaving directory '/home/joseph/Documents/v'
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc -g -std=gnu99 -w -o ./v ./vc/v.c -lm -lpthread
./v self
V self compiling ...
make modules
make[1]: Entering directory '/home/joseph/Documents/v'
#./v build module vlib/builtin > /dev/null
#./v build module vlib/strings > /dev/null
#./v build module vlib/strconv > /dev/null
make[1]: Leaving directory '/home/joseph/Documents/v'
V has been successfully built
V 0.1.30 fe0ded9
Current V version:
V 0.1.30 fe0ded9
It looks like V is updated and running properly RN. I just cloned, built, and ran v up and saw that message. It told me to report the issue on GitHub, so I reported it.
V panic: get_type_symbol: invalid type (typ=0 idx=0). Compiler bug. This should never happen. Please create a GitHub issue.
That's because V attempts to build itself. But sometimes internal breaking changes are introduced where this process fails.
"/home/joseph/Documents/v/v" selffailed, runningmake...
If this happens V runs make to be bootstrapped via vc. So this is not really an bug.
@serkonda7 even if it isn't an issue, I didn't want (or expect) to see it. Maybe there is a way to hide this error?
I understand your point, the exact error messages might distract users.
@josephworks could you please open a small feature request?
So the way V up works is it runs make for such cases, when v self fails.
That's what happened here. We just need to hide these scary messages from the user (especially the segfault).