summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lookups.nim2
-rw-r--r--tests/errmsgs/treportunused.nim29
2 files changed, 30 insertions, 1 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index d2e7fdcfa..2fb4e5241 100644
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -168,7 +168,7 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
         localError(c.config, s.info, "implementation of '$1' expected" %
             getSymRepr(c.config, s))
       inc missingImpls
-    elif {sfUsed, sfExported} * s.flags == {} and optHints in s.options:
+    elif {sfUsed, sfExported} * s.flags == {}:
       if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam}:
         # XXX: implicit type params are currently skTypes
         # maybe they can be made skGenericParam as well.
diff --git a/tests/errmsgs/treportunused.nim b/tests/errmsgs/treportunused.nim
new file mode 100644
index 000000000..929da8843
--- /dev/null
+++ b/tests/errmsgs/treportunused.nim
@@ -0,0 +1,29 @@
+discard """
+  nimout: '''
+treportunused.nim(19, 10) Hint: 'treportunused.s1(a: string)[declared in treportunused.nim(19, 9)]' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(26, 5) Hint: 's8' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(22, 6) Hint: 'treportunused.s4()[declared in treportunused.nim(22, 5)]' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(25, 7) Hint: 's7' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(24, 7) Hint: 's6' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(23, 6) Hint: 'treportunused.s5(a: T)[declared in treportunused.nim(23, 5)]' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(20, 10) Hint: 'treportunused.s2()[declared in treportunused.nim(20, 9)]' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(29, 6) Hint: 's11' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(27, 5) Hint: 's9' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(21, 10) Hint: 's3' is declared but not used [XDeclaredButNotUsed]
+treportunused.nim(28, 6) Hint: 's10' is declared but not used [XDeclaredButNotUsed]
+'''
+"""
+
+# bug #9764
+
+iterator s1(a:string): int = discard
+iterator s2(): int = discard
+template s3(): untyped = 123
+proc s4(): int = 123
+proc s5[T](a: T): int = 123
+macro s6(a: int): untyped = discard
+const s7 = 0
+let s8 = 0
+var s9: int
+type s10 = object
+type s11 = type(1.2)