potential fix for semgeneric formal params (#17494)
marked locations where analysis of return formal param is done prior to args. This might fix some subtle bugs.
This commit is contained in:
parent
1590d14575
commit
7366a3da37
3 changed files with 8 additions and 2 deletions
|
|
@ -452,8 +452,6 @@ proc semGenericStmt(c: PContext, n: PNode,
|
|||
discard
|
||||
of nkFormalParams:
|
||||
checkMinSonsLen(n, 1, c.config)
|
||||
if n[0].kind != nkEmpty:
|
||||
n[0] = semGenericStmt(c, n[0], flags+{withinTypeDesc}, ctx)
|
||||
for i in 1..<n.len:
|
||||
var a = n[i]
|
||||
if (a.kind != nkIdentDefs): illFormedAst(a, c.config)
|
||||
|
|
@ -462,6 +460,10 @@ proc semGenericStmt(c: PContext, n: PNode,
|
|||
a[^1] = semGenericStmt(c, a[^1], flags, ctx)
|
||||
for j in 0..<a.len-2:
|
||||
addTempDecl(c, getIdentNode(c, a[j]), skParam)
|
||||
# XXX: last change was moving this down here, search for "1.." to keep
|
||||
# going from this file onward
|
||||
if n[0].kind != nkEmpty:
|
||||
n[0] = semGenericStmt(c, n[0], flags+{withinTypeDesc}, ctx)
|
||||
of nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef,
|
||||
nkFuncDef, nkIteratorDef, nkLambdaKinds:
|
||||
checkSonsLen(n, bodyPos + 1, c.config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue