summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorJosé Paulo <rockcavera@gmail.com>2024-04-21 16:30:12 -0300
committerGitHub <noreply@github.com>2024-04-21 21:30:12 +0200
commit60af04635f44e655c7928da36fc9394e11367d18 (patch)
treee221d02f253d6769076c192d56c3b5fc08acb5ea /compiler
parent1185b93c6dabc515f279df7c11780fea07676b25 (diff)
downloadNim-60af04635f44e655c7928da36fc9394e11367d18.tar.gz
fix #23518 - `<expr> is` crashes nimsuggest (#23523)
This solution should resolve the nimsuggest crash issue. However,
perhaps the problem is in the parser?

fix #23518
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semexprs.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 61d4687a3..17a3082ff 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -518,8 +518,9 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
   result.typ = n.typ
 
 proc semIs(c: PContext, n: PNode, flags: TExprFlags): PNode =
-  if n.len != 3:
+  if n.len != 3 or n[2].kind == nkEmpty:
     localError(c.config, n.info, "'is' operator takes 2 arguments")
+    return errorNode(c, n)
 
   let boolType = getSysType(c.graph, n.info, tyBool)
   result = n