summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semdata.nim1
-rw-r--r--compiler/suggest.nim7
-rw-r--r--tests/deprecated/tmessages.nim10
3 files changed, 17 insertions, 1 deletions
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 5a2c08de2..8680fcac3 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -143,6 +143,7 @@ type
       # would otherwise fail.
     unusedImports*: seq[(PSym, TLineInfo)]
     exportIndirections*: HashSet[(int, int)]
+    lastTLineInfo*: TLineInfo
 
 template config*(c: PContext): ConfigRef = c.graph.config
 
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index a9f248fb9..6e9844759 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -557,7 +557,12 @@ proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
     if sfDeprecated in s.owner.flags:
       warnAboutDeprecated(conf, info, s)
   if {sfDeprecated, sfError} * s.flags != {}:
-    if sfDeprecated in s.flags: warnAboutDeprecated(conf, info, s)
+    if sfDeprecated in s.flags:
+      if not (c.lastTLineInfo.line == info.line and 
+              c.lastTLineInfo.col == info.col):
+        warnAboutDeprecated(conf, info, s)
+        c.lastTLineInfo = info
+
     if sfError in s.flags: userError(conf, info, s)
   when defined(nimsuggest):
     suggestSym(conf, info, s, c.graph.usageSym, false)
diff --git a/tests/deprecated/tmessages.nim b/tests/deprecated/tmessages.nim
new file mode 100644
index 000000000..5884e396d
--- /dev/null
+++ b/tests/deprecated/tmessages.nim
@@ -0,0 +1,10 @@
+discard """
+  nimout:'''tmessages.nim(10, 1) Warning: Deprecated since v1.2.0, use 'HelloZ'; hello is deprecated [Deprecated]
+'''
+"""
+
+proc hello[T](a: T) {.deprecated: "Deprecated since v1.2.0, use 'HelloZ'".} =
+  discard
+
+
+hello[int](12)