* fix #20253

* change NimbleStableCommit

* Update koch.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Bung 2023-01-13 06:36:13 -08:00 • committed by GitHub
commit 5f41be3b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -1488,6 +1488,9 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) =
s.kind in {skProc, skFunc, skConverter, skMethod} and s.magic == mNone: s.kind in {skProc, skFunc, skConverter, skMethod} and s.magic == mNone:
var res = s.ast[resultPos].sym # get result symbol var res = s.ast[resultPos].sym # get result symbol
if res.id notin t.init: if res.id notin t.init:
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") message(g.config, body.info, warnProveInit, "result")
let p = s.ast[pragmasPos] let p = s.ast[pragmasPos]
let raisesSpec = effectSpec(p, wRaises) let raisesSpec = effectSpec(p, wRaises)

10
tests/misc/t20253.nim Normal file
View file

@ -0,0 +1,10 @@
discard """
errormsg: "'result' requires explicit initialization"
line: 10
"""
type Meow {.requiresInit.} = object
init: bool
proc initMeow(): Meow =
discard