From 5bbc5edf43e6ede3d162f0463cb74c0a6d58cc1d Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Wed, 27 Jul 2022 17:15:51 +0800 Subject: [PATCH] fixes #20031; uint64 is an ordinal type since 1.0 (#20094) * fixes #20031; uint64 is an ordinal type since 1.0 * Update compiler/semstmts.nim --- compiler/semstmts.nim | 2 +- tests/casestmt/tcasestmt.nim | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index f6136c363b..8b0691abf4 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1050,7 +1050,7 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode = var typ = commonTypeBegin var hasElse = false let caseTyp = skipTypes(n[0].typ, abstractVar-{tyTypeDesc}) - const shouldChckCovered = {tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt32, tyBool} + const shouldChckCovered = {tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt64, tyBool} case caseTyp.kind of shouldChckCovered: chckCovered = true diff --git a/tests/casestmt/tcasestmt.nim b/tests/casestmt/tcasestmt.nim index 53cccdb641..3a4907494a 100644 --- a/tests/casestmt/tcasestmt.nim +++ b/tests/casestmt/tcasestmt.nim @@ -287,3 +287,14 @@ doAssert(foo2("Y", "a2") == 0) doAssert(foo2("Y", "2a") == 2) doAssert(foo2("N", "a3") == 3) doAssert(foo2("z", "2") == 0) + + +# bug #20031 +proc main(a: uint64) = + case a + else: + discard + +static: + main(10) +main(10)