fix parseEnum cannot parse enum with const fields (#19466)

fix #19463
This commit is contained in:
flywind 2022-02-04 20:47:03 +08:00 • committed by GitHub
commit 33bfe5b12c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -583,6 +583,17 @@ template main() =
let g = parseEnum[Foo]("Bar", A)
doAssert g == A
block: # bug #19463
const CAMPAIGN_TABLE = "wikientries_campaign"
const CHARACTER_TABLE = "wikientries_character"
type Tables = enum
a = CAMPAIGN_TABLE,
b = CHARACTER_TABLE,
let myA = CAMPAIGN_TABLE
doAssert $parseEnum[Tables](myA) == "wikientries_campaign"
block: # check enum defined in block
type
Bar = enum