From 3a134acc5a93602a10e28b377c6bf7cb96b1cf04 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 15 Apr 2021 03:11:24 +0300 Subject: [PATCH] checker: orm: verify table type --- vlib/v/checker/checker.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index abf4ca9e3a..0968de04c9 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -6271,6 +6271,10 @@ fn (mut c Checker) sql_stmt(mut node ast.SqlStmt) ast.Type { c.ensure_type_exists(node.table_expr.typ, node.pos) or { return ast.void_type } table_sym := c.table.get_type_symbol(node.table_expr.typ) c.cur_orm_ts = table_sym + if table_sym.info !is ast.Struct { + c.error('unknown type `$table_sym.name`', node.pos) + return ast.void_type + } info := table_sym.info as ast.Struct fields := c.fetch_and_verify_orm_fields(info, node.table_expr.pos, table_sym.name) mut sub_structs := map[int]ast.SqlStmt{}