summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-04-03 12:28:06 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-04-03 12:28:06 +0200
commite8cfa1435408bc4c5ad89908449ab1b39b13f56f (patch)
tree3c0b7446151ad95ef3b4496b7a496fd73b9def13
parent57b7c45128bc4257157ce905537db2f3fb970b7b (diff)
downloadNim-e8cfa1435408bc4c5ad89908449ab1b39b13f56f.tar.gz
de-deprecate silly warning about non-exhaustive string case statments
-rw-r--r--compiler/semstmts.nim10
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 5f025f943..fec0a80d3 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -205,13 +205,12 @@ proc semCase(c: PContext, n: PNode): PNode =
   var covered: BiggestInt = 0
   var typ = commonTypeBegin
   var hasElse = false
-  var notOrdinal = false
   let caseTyp = skipTypes(n.sons[0].typ, abstractVarRange-{tyTypeDesc})
   case caseTyp.kind
   of tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt32, tyBool:
     chckCovered = true
   of tyFloat..tyFloat128, tyString, tyError:
-    notOrdinal = true
+    discard
   else:
     localError(n.info, errSelectorMustBeOfCertainTypes)
     return
@@ -244,9 +243,6 @@ proc semCase(c: PContext, n: PNode): PNode =
       hasElse = true
     else:
       illFormedAst(x)
-  if notOrdinal and not hasElse:
-    message(n.info, warnDeprecated,
-            "use 'else: discard'; non-ordinal case without 'else'")
   if chckCovered:
     if covered == toCover(n.sons[0].typ):
       hasElse = true
@@ -1631,7 +1627,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
             elif expr[2].typ.isUnresolvedStatic:
               inferConceptStaticParam(c, expr[2], expr[1])
               continue
-            
+
           let verdict = semConstExpr(c, n[i])
           if verdict.intVal == 0:
             localError(result.info, "type class predicate failed")
@@ -1655,7 +1651,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
           of nkPragma, nkCommentStmt, nkNilLit, nkEmpty: discard
           else: localError(n.sons[j].info, errStmtInvalidAfterReturn)
       else: discard
-  
+
   if result.len == 1 and
      c.inTypeClass == 0 and # concept bodies should be preserved as a stmt list
      result.sons[0].kind != nkDefer: