Warnings missing when compiling the same file twice
### Description

This is a test case from #23386 - if compiled twice, the expected `GenericsIgnoredInjection` warning is only printed the first time (!)

```nim
type Xxx = enum
  error
  value

type
  Result[T, E] = object
    when T is void:
      when E is void:
        oResultPrivate*: bool
      else:
        case oResultPrivate*: bool
        of false:
          eResultPrivate*: E
        of true:
          discard
    else:
      when E is void:
        case oResultPrivate*: bool
        of false:
          discard
        of true:
          vResultPrivate*: T
      else:
        case oResultPrivate*: bool
        of false:
          eResultPrivate*: E
        of true:
          vResultPrivate*: T

template valueOr[T: not void, E](self: Result[T, E], def: untyped): untyped =
  let s = (self) # TODO avoid copy
  case s.oResultPrivate
  of true:
    s.vResultPrivate
  of false:
    when E isnot void:
      template error: untyped {.used, inject.} = s.eResultPrivate
    def

proc f(): Result[int, cstring] =
  Result[int, cstring](oResultPrivate: false, eResultPrivate: "f")

proc g(T: type): string =
  let x = f().valueOr:
    return $error #[tt.Warning
            ^ a new symbol 'error' has been injected during instantiation of g, however 'error' [enumField declared in tmacroinjectedsymwarning.nim(2, 3)] captured at the proc declaration will be used instead; either enable --experimental:genericsOpenSym to use the injected symbol or `bind` this captured symbol explicitly [GenericsIgnoredInjection]]#

  "ok"


discard g(int)```


### Nim Version

Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-07-20
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release



### Current Output

```text
nim c -r "/tmp/testit.nim"
Hint: used config file '/home/arnetheduck/.nimble/pkgs2/nim-2.0.8-46333e8f4bda41dd6d3852a3f5fa4975b96b66a2/config/nim.cfg' [Conf]
Hint: used config file '/home/arnetheduck/.nimble/pkgs2/nim-2.0.8-46333e8f4bda41dd6d3852a3f5fa4975b96b66a2/config/config.nims' [Conf]
Hint: used config file '/home/arnetheduck/.config/nim/nim.cfg' [Conf]
......................................................................
/tmp/testit.nim(51, 10) template/generic instantiation of `g` from here
/tmp/testit.nim(44, 14) template/generic instantiation of `valueOr` from here
/tmp/testit.nim(45, 13) Warning: a new symbol 'error' has been injected during instantiation of g, however 'error' [enumField declared in /tmp/testit.nim(2, 3)] captured at the proc declaration will be used instead; either enable --experimental:genericsOpenSym to use the injected symbol or `bind` this captured symbol explicitly [GenericsIgnoredInjection]
/tmp/testit.nim(44, 7) Hint: 'x' is declared but not used [XDeclaredButNotUsed]
CC: testit.nim
Hint:  [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
27831 lines; 0.189s; 30.402MiB peakmem; proj: /tmp/testit.nim; out: /tmp/testit [SuccessX]
Hint: /tmp/testit [Exec]
arnetheduck@praeceps:~/src/nim-results$ nim c -r "/tmp/testit.nim"
Hint: used config file '/home/arnetheduck/.nimble/pkgs2/nim-2.0.8-46333e8f4bda41dd6d3852a3f5fa4975b96b66a2/config/nim.cfg' [Conf]
Hint: used config file '/home/arnetheduck/.nimble/pkgs2/nim-2.0.8-46333e8f4bda41dd6d3852a3f5fa4975b96b66a2/config/config.nims' [Conf]
Hint: used config file '/home/arnetheduck/.config/nim/nim.cfg' [Conf]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
10128 lines; 0.016s; 10.477MiB peakmem; proj: /tmp/testit.nim; out: /tmp/testit [SuccessX]
Hint: /tmp/testit [Exec]
```


### Expected Output

_No response_

### Possible Solution

_No response_

### Additional Information

_No response_