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
parent 772ed5eff2
commit 33bfe5b12c
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