mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
fixes #25117 errors on `requiresInit` of `result` if it is used before initialization. Otherwise ```nim # prevent superfluous warnings about the same variable: a.init.add s.id ``` It produces a warning, and this line prevents it from being recognized by the `requiresInit` check in `trackProc`
13 lines
211 B
Nim
13 lines
211 B
Nim
discard """
|
|
errormsg: "'result' requires explicit initialization"
|
|
"""
|
|
|
|
type RI {.requiresInit.} = object
|
|
v: int
|
|
|
|
proc xxx(v: var RI) = discard
|
|
|
|
proc f(T: type): T =
|
|
xxx(result) # Should fail
|
|
|
|
discard f(RI) |