mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
* Fix #15599
* Add test
(cherry picked from commit 66cd9c2e57)
This commit is contained in:
@@ -527,7 +527,7 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
||||
if n[^1].kind == nkSym and n[^1].sym.kind notin {skProc, skFunc}:
|
||||
localError(c.config, n.info, "finalizer must be a direct reference to a proc")
|
||||
elif optTinyRtti in c.config.globalOptions:
|
||||
let fin = if n[^1].kind == nkLambda: n[^1][namePos].sym
|
||||
let fin = if n[^1].kind in {nkLambda, nkDo}: n[^1][namePos].sym
|
||||
else: n[^1].sym
|
||||
# check if we converted this finalizer into a destructor already:
|
||||
let t = whereToBindTypeHook(c, fin.typ[1].skipTypes(abstractInst+{tyRef}))
|
||||
|
||||
@@ -26,6 +26,7 @@ new line after - @['a']
|
||||
finalizer
|
||||
aaaaa
|
||||
hello
|
||||
ok
|
||||
closed
|
||||
destroying variable: 20
|
||||
destroying variable: 10
|
||||
@@ -377,4 +378,15 @@ proc text_parser(xml: var XmlParser) =
|
||||
doAssert(test_passed)
|
||||
|
||||
text_parser(xml)
|
||||
text_parser(xml2)
|
||||
text_parser(xml2)
|
||||
|
||||
# bug #15599
|
||||
type
|
||||
PixelBuffer = ref object
|
||||
|
||||
proc newPixelBuffer(): PixelBuffer =
|
||||
new(result) do (buffer: PixelBuffer):
|
||||
echo "ok"
|
||||
|
||||
discard newPixelBuffer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user