Skip to content

Commit 3a134ac

Browse files
committed
checker: orm: verify table type
1 parent 21c452c commit 3a134ac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vlib/v/checker/checker.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6271,6 +6271,10 @@ fn (mut c Checker) sql_stmt(mut node ast.SqlStmt) ast.Type {
62716271
c.ensure_type_exists(node.table_expr.typ, node.pos) or { return ast.void_type }
62726272
table_sym := c.table.get_type_symbol(node.table_expr.typ)
62736273
c.cur_orm_ts = table_sym
6274+
if table_sym.info !is ast.Struct {
6275+
c.error('unknown type `$table_sym.name`', node.pos)
6276+
return ast.void_type
6277+
}
62746278
info := table_sym.info as ast.Struct
62756279
fields := c.fetch_and_verify_orm_fields(info, node.table_expr.pos, table_sym.name)
62766280
mut sub_structs := map[int]ast.SqlStmt{}

0 commit comments

Comments
 (0)