mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 03:14:08 +00:00
* fix #20253 * change NimbleStableCommit * Update koch.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
@@ -1488,7 +1488,10 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) =
|
||||
s.kind in {skProc, skFunc, skConverter, skMethod} and s.magic == mNone:
|
||||
var res = s.ast[resultPos].sym # get result symbol
|
||||
if res.id notin t.init:
|
||||
message(g.config, body.info, warnProveInit, "result")
|
||||
if tfRequiresInit in s.typ[0].flags:
|
||||
localError(g.config, body.info, "'$1' requires explicit initialization" % "result")
|
||||
else:
|
||||
message(g.config, body.info, warnProveInit, "result")
|
||||
let p = s.ast[pragmasPos]
|
||||
let raisesSpec = effectSpec(p, wRaises)
|
||||
if not isNil(raisesSpec):
|
||||
|
||||
10
tests/misc/t20253.nim
Normal file
10
tests/misc/t20253.nim
Normal file
@@ -0,0 +1,10 @@
|
||||
discard """
|
||||
errormsg: "'result' requires explicit initialization"
|
||||
line: 10
|
||||
"""
|
||||
|
||||
type Meow {.requiresInit.} = object
|
||||
init: bool
|
||||
|
||||
proc initMeow(): Meow =
|
||||
discard
|
||||
Reference in New Issue
Block a user