mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #2823
This commit is contained in:
@@ -323,7 +323,8 @@ proc paramStorageLoc(param: PSym): TStorageLoc =
|
||||
result = OnUnknown
|
||||
|
||||
proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
||||
check: var IntSet, declareEnvironment=true) =
|
||||
check: var IntSet, declareEnvironment=true;
|
||||
weakDep=false) =
|
||||
params = nil
|
||||
if (t.sons[0] == nil) or isInvalidReturnType(t.sons[0]):
|
||||
rettype = ~"void"
|
||||
@@ -341,6 +342,8 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
||||
add(params, ~"*")
|
||||
incl(param.loc.flags, lfIndirect)
|
||||
param.loc.s = OnUnknown
|
||||
elif weakDep:
|
||||
add(params, getTypeDescWeak(m, param.typ, check))
|
||||
else:
|
||||
add(params, getTypeDescAux(m, param.typ, check))
|
||||
add(params, ~" ")
|
||||
@@ -577,7 +580,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope =
|
||||
result = getTypeName(t)
|
||||
idTablePut(m.typeCache, t, result)
|
||||
var rettype, desc: Rope
|
||||
genProcParams(m, t, rettype, desc, check)
|
||||
genProcParams(m, t, rettype, desc, check, true, true)
|
||||
if not isImportedType(t):
|
||||
if t.callConv != ccClosure: # procedure vars may need a closure!
|
||||
addf(m.s[cfsTypes], "typedef $1_PTR($2, $3) $4;$n",
|
||||
|
||||
@@ -6,3 +6,9 @@ proc f(x: proc: MalType) =
|
||||
discard x()
|
||||
|
||||
f(nil)
|
||||
|
||||
# bug #2823
|
||||
|
||||
type A = object #of RootObj <-- Uncomment this to get no errors
|
||||
test: proc(i: A): bool
|
||||
var a: proc(i: A): bool # Or comment this line to get no errors
|
||||
|
||||
Reference in New Issue
Block a user