From 23e8c8ecdab7023e3ae961b59e52c9b024898048 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 24 May 2020 20:55:04 +0300 Subject: [PATCH] checker: prevent infinite recursion on a:=b b:=a --- vlib/v/checker/checker.v | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 78576d9dd3..a3fecd554b 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1855,6 +1855,13 @@ pub fn (mut c Checker) ident(mut ident ast.Ident) table.Type { ast.Var { mut typ := it.typ if typ == 0 { + if it.expr is ast.Ident { + inner_ident := it.expr as ast.Ident + if inner_ident.kind == .unresolved { + c.error('unresolved variable: `$ident.name`', ident.pos) + return table.void_type + } + } typ = c.expr(it.expr) } is_optional := typ.flag_is(.optional)