diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2018-12-30 23:04:41 +0530 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-30 18:34:41 +0100 |
commit | bcbe317d177e9a22856e8dd6c0ad1e20436b913a (patch) | |
tree | df6901d46ac751012fae48c94a6d83820d7a8270 | |
parent | 2ee2022c29ec4774eda51cb431052a9fc24982a7 (diff) | |
download | Nim-bcbe317d177e9a22856e8dd6c0ad1e20436b913a.tar.gz |
Before showing deprecated warning, check whether enum field was marked deprecated or the whole enum type (#10135)
-rw-r--r-- | compiler/suggest.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/suggest.nim b/compiler/suggest.nim index f149327ac..d3ce46172 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -464,7 +464,7 @@ proc extractPragma(s: PSym): PNode = proc warnAboutDeprecated(conf: ConfigRef; info: TLineInfo; s: PSym) = let pragmaNode = if s.kind == skEnumField: extractPragma(s.owner) else: extractPragma(s) let name = - if s.kind == skEnumField: "enum '" & s.owner.name.s & "' which contains field '" & s.name.s & "'" + if s.kind == skEnumField and sfDeprecated notin s.flags: "enum '" & s.owner.name.s & "' which contains field '" & s.name.s & "'" else: s.name.s if pragmaNode != nil: for it in pragmaNode: @@ -490,7 +490,7 @@ proc markUsed(conf: ConfigRef; info: TLineInfo; s: PSym; usageSym: var PSym) = if s.kind == skEnumField and s.owner != nil: incl(s.owner.flags, sfUsed) if sfDeprecated in s.owner.flags: - incl(s.flags, sfDeprecated) + warnAboutDeprecated(conf, info, s) if {sfDeprecated, sfError} * s.flags != {}: if sfDeprecated in s.flags: warnAboutDeprecated(conf, info, s) if sfError in s.flags: userError(conf, info, s) |