From ff591da80bd7c34028453be44a46efba22d71035 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:03:46 +0800 Subject: [PATCH] fixes #24379; better error messages for ill-formed type symbols fixes #24379 --- compiler/semexprs.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 60a9c56f9c88e..6cc4afd6e0080 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1492,6 +1492,8 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode = if n.kind != nkDotExpr: # dotExpr is already checked by builtinFieldAccess markUsed(c, n.info, s) onUse(n.info, s) + if s.typ == nil: + return localErrorNode(c, n, "symbol '$1' has no type" % [s.name.s]) if s.typ.kind == tyStatic and s.typ.base.kind != tyNone and s.typ.n != nil: return s.typ.n result = newSymNode(s, n.info)