mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 10:54:42 +00:00
This commit is contained in:
@@ -8,11 +8,10 @@
|
||||
#
|
||||
|
||||
# This module implements lookup helpers.
|
||||
|
||||
import std/[algorithm, strutils]
|
||||
import
|
||||
intsets, ast, astalgo, idents, semdata, types, msgs, options,
|
||||
renderer, nimfix/prettybase, lineinfos, strutils,
|
||||
modulegraphs, astmsgs
|
||||
renderer, nimfix/prettybase, lineinfos, modulegraphs, astmsgs
|
||||
|
||||
proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope)
|
||||
|
||||
@@ -268,6 +267,7 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
|
||||
var it: TTabIter
|
||||
var s = initTabIter(it, scope.symbols)
|
||||
var missingImpls = 0
|
||||
var unusedSyms: seq[tuple[sym: PSym, key: string]]
|
||||
while s != nil:
|
||||
if sfForward in s.flags and s.kind notin {skType, skModule}:
|
||||
# too many 'implementation of X' errors are annoying
|
||||
@@ -282,8 +282,10 @@ proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) =
|
||||
# maybe they can be made skGenericParam as well.
|
||||
if s.typ != nil and tfImplicitTypeParam notin s.typ.flags and
|
||||
s.typ.kind != tyGenericParam:
|
||||
message(c.config, s.info, hintXDeclaredButNotUsed, s.name.s)
|
||||
unusedSyms.add (s, toFileLineCol(c.config, s.info))
|
||||
s = nextIter(it, scope.symbols)
|
||||
for (s, _) in sortedByIt(unusedSyms, it.key):
|
||||
message(c.config, s.info, hintXDeclaredButNotUsed, s.name.s)
|
||||
|
||||
proc wrongRedefinition*(c: PContext; info: TLineInfo, s: string;
|
||||
conflictsWith: TLineInfo) =
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
discard """
|
||||
matrix: "--hint:all:off --hint:XDeclaredButNotUsed"
|
||||
nimoutFull: true
|
||||
nimout: '''
|
||||
treportunused.nim(19, 10) Hint: 's1' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(26, 5) Hint: 's8' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(22, 6) Hint: 's4' 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: 's5' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(20, 10) Hint: 's2' 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]
|
||||
treportunused.nim(21, 10) Hint: 's1' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(22, 10) Hint: 's2' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(23, 10) Hint: 's3' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(24, 6) Hint: 's4' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(25, 6) Hint: 's5' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(26, 7) Hint: 's6' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(27, 7) Hint: 's7' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(28, 5) Hint: 's8' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(29, 5) Hint: 's9' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(30, 6) Hint: 's10' is declared but not used [XDeclaredButNotUsed]
|
||||
treportunused.nim(31, 6) Hint: 's11' is declared but not used [XDeclaredButNotUsed]
|
||||
'''
|
||||
action: compile
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user