Merge pull request #9898 from cooldome/enum_notused

Enum fields get hintXDeclaredButNotUsed hint even marked with used pragma
This commit is contained in:
Andreas Rumpf 2018-12-09 09:51:35 +01:00 • committed by GitHub
commit 8035f408f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -169,7 +169,7 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
getSymRepr(c.config, s)) getSymRepr(c.config, s))
inc missingImpls inc missingImpls
elif {sfUsed, sfExported} * s.flags == {}: elif {sfUsed, sfExported} * s.flags == {}:
if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam}: if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam, skEnumField}:
# XXX: implicit type params are currently skTypes # XXX: implicit type params are currently skTypes
# maybe they can be made skGenericParam as well. # maybe they can be made skGenericParam as well.
if s.typ != nil and tfImplicitTypeParam notin s.typ.flags and if s.typ != nil and tfImplicitTypeParam notin s.typ.flags and

View file

@ -31,5 +31,11 @@ block:
implementArithOpsNew(int) implementArithOpsNew(int)
echoAdd 3, 5 echoAdd 3, 5
# issue #9896
type
MyEnum {.used.} = enum
Val1, Val2, Val3
static: static:
echo "compile end" echo "compile end"