From 294b1566e7eeccd684162a86ee8e35e7763c4784 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:03:17 +0800 Subject: [PATCH] fixes #23952; Size/Signedness issues with unordered enums (#24356) fixes #23952 It reorders `type Foo = enum A, B = -1` to `type Foo = enum B = -1, A` so that `firstOrd` etc. continue to work. --- compiler/semtypes.nim | 12 +++++++++++- tests/enum/tenum.nim | 22 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 870b515121..e3c6fb1090 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -84,6 +84,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = let isPure = result.sym != nil and sfPure in result.sym.flags var symbols: TStrTable = initStrTable() var hasNull = false + var needsReorder = false for i in 1..