parent
505d04389a
commit
0d0e43469f
2 changed files with 20 additions and 1 deletions
|
|
@ -3094,7 +3094,9 @@ proc genBracedInit(p: BProc, n: PNode; isConst: bool; optionalType: PType): Rope
|
||||||
else:
|
else:
|
||||||
result = genConstSeq(p, n, typ, isConst)
|
result = genConstSeq(p, n, typ, isConst)
|
||||||
of tyProc:
|
of tyProc:
|
||||||
if typ.callConv == ccClosure and n.len > 1 and n[1].kind == nkNilLit:
|
if typ.callConv == ccClosure and n.safeLen > 1 and n[1].kind == nkNilLit:
|
||||||
|
# n.kind could be: nkClosure, nkTupleConstr and maybe others; `n.safeLen`
|
||||||
|
# guards against the case of `nkSym`, refs bug #14340.
|
||||||
# Conversion: nimcall -> closure.
|
# Conversion: nimcall -> closure.
|
||||||
# this hack fixes issue that nkNilLit is expanded to {NIM_NIL,NIM_NIL}
|
# this hack fixes issue that nkNilLit is expanded to {NIM_NIL,NIM_NIL}
|
||||||
# this behaviour is needed since closure_var = nil must be
|
# this behaviour is needed since closure_var = nil must be
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,23 @@ block: # bug #8007
|
||||||
const d = @[Cost(kind: Fixed, cost: 999), Cost(kind: Dynamic, handler: foo)]
|
const d = @[Cost(kind: Fixed, cost: 999), Cost(kind: Dynamic, handler: foo)]
|
||||||
doAssert $d == "@[(kind: Fixed, cost: 999), (kind: Dynamic, handler: ...)]"
|
doAssert $d == "@[(kind: Fixed, cost: 999), (kind: Dynamic, handler: ...)]"
|
||||||
|
|
||||||
|
block: # bug #14340
|
||||||
|
block:
|
||||||
|
proc opl3EnvelopeCalcSin0() = discard
|
||||||
|
type EnvelopeSinfunc = proc()
|
||||||
|
# const EnvelopeCalcSin0 = opl3EnvelopeCalcSin0 # ok
|
||||||
|
const EnvelopeCalcSin0: EnvelopeSinfunc = opl3EnvelopeCalcSin0 # was bug
|
||||||
|
const envelopeSin = [EnvelopeCalcSin0]
|
||||||
|
var a = 0
|
||||||
|
envelopeSin[a]()
|
||||||
|
|
||||||
|
block:
|
||||||
|
type Mutator = proc() {.noSideEffect, gcsafe, locks: 0.}
|
||||||
|
proc mutator0() = discard
|
||||||
|
const mTable = [Mutator(mutator0)]
|
||||||
|
var i=0
|
||||||
|
mTable[i]()
|
||||||
|
|
||||||
block: # VM wrong register free causes errors in unrelated code
|
block: # VM wrong register free causes errors in unrelated code
|
||||||
block: # bug #15597
|
block: # bug #15597
|
||||||
#[
|
#[
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue