summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-07-06 22:56:34 +0200
committerAraq <rumpf_a@web.de>2014-07-06 22:56:34 +0200
commitf9d7e8db2a8b89575df51768ce9e5aa66c47cc9f (patch)
treeb8b5d57d92e753caa25669e3cf8843e89f5d1ebe /compiler
parent21be7bf85a4d8cdff1acfcc5c8b9bf9c0727b290 (diff)
downloadNim-f9d7e8db2a8b89575df51768ce9e5aa66c47cc9f.tar.gz
implements #1332
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index b075e603d..53fe4e266 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -443,14 +443,14 @@ proc semCaseBranch(c: PContext, t, branch: PNode, branchIndex: int,
     elif isRange(b):
       branch.sons[i] = semCaseBranchRange(c, t, b, covered)
     else:
+      # constant sets and arrays are allowed:
       var r = semConstExpr(c, b)
       # for ``{}`` we want to trigger the type mismatch in ``fitNode``:
-      if r.kind != nkCurly or len(r) == 0:
+      if r.kind notin {nkCurly, nkBracket} or len(r) == 0:
         checkMinSonsLen(t, 1)
         branch.sons[i] = skipConv(fitNode(c, t.sons[0].typ, r))
         inc(covered)
       else:
-        # constant sets have special rules
         # first element is special and will overwrite: branch.sons[i]:
         branch.sons[i] = semCaseBranchSetElem(c, t, r[0], covered)
         # other elements have to be added to ``branch``