44# See the file "license.txt", included in this
55# distribution, for details about the copyright.
66
7- import std / [syncio, strutils, os, terminal, assertions]
7+ import std / [syncio, strutils, os, terminal, assertions, sets ]
88import nifstreams, nifcursors, bitabs, lineinfos
99
1010type
2121 assertOnError* : bool
2222 warnings* : int
2323 errors* : int
24+ reportedErrSources: HashSet [PackedLineInfo ]
25+
2426
2527proc useColors * (): bool = terminal.isatty (stdout)
2628
@@ -108,6 +110,7 @@ proc reportErrors*(dest: var TokenBuf): int =
108110 if dest[i].kind == ParLe and dest[i].tagId == errTag:
109111 inc result
110112 let info = dest[i].info
113+ let doReport = not r.reportedErrSources.containsOrIncl (info)
111114 inc i
112115 # original expression, optional:
113116 if dest[i].kind == DotToken :
@@ -118,11 +121,13 @@ proc reportErrors*(dest: var TokenBuf): int =
118121 endRead (dest)
119122 # instantiation contexts:
120123 while dest[i].kind == DotToken :
121- r.trace infoToStr (dest[i].info), " instantiation from here"
124+ if doReport:
125+ r.trace infoToStr (dest[i].info), " instantiation from here"
122126 inc i
123127 # error message:
124128 assert dest[i].kind == StringLit
125- r.error infoToStr (info), pool.strings[dest[i].litId]
129+ if doReport:
130+ r.error infoToStr (info), pool.strings[dest[i].litId]
126131 inc i
127132 else :
128133 inc i
0 commit comments