summary refs log tree commit diff stats
path: root/compiler/semobjconstr.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-12-04 07:42:34 +0100
committerGitHub <noreply@github.com>2021-12-04 07:42:34 +0100
commit23c117a950a3ce0e3c85d4f89409075329648230 (patch)
treefaeb52e4c659f3c559193f92b716d20c450aea4b /compiler/semobjconstr.nim
parent373c909300c9ecef159666ac196e360fbd7a3ebc (diff)
downloadNim-23c117a950a3ce0e3c85d4f89409075329648230.tar.gz
misc bugfixes [backport:1.2] (#19203)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r--compiler/semobjconstr.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index 30ab76957..6d11d321e 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -366,9 +366,9 @@ proc defaultConstructionError(c: PContext, t: PType, info: TLineInfo) =
   if objType.kind == tyObject:
     var constrCtx = initConstrContext(objType, newNodeI(nkObjConstr, info))
     let initResult = semConstructTypeAux(c, constrCtx, {})
-    assert constrCtx.missingFields.len > 0
-    localError(c.config, info,
-      "The $1 type doesn't have a default value. The following fields must be initialized: $2." % [typeToString(t), listSymbolNames(constrCtx.missingFields)])
+    if constrCtx.missingFields.len > 0:
+      localError(c.config, info,
+        "The $1 type doesn't have a default value. The following fields must be initialized: $2." % [typeToString(t), listSymbolNames(constrCtx.missingFields)])
   elif objType.kind == tyDistinct:
     localError(c.config, info,
       "The $1 distinct type doesn't have a default value." % typeToString(t))