-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #22548;environment misses for type reference in iterator access n… #22559
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
@bung87 |
edc32f8
to
38d298e
Compare
!nim c template mytoSeq*(iter: untyped): untyped =
var result: seq[typeof(iter)]# = @[]
for x in iter:
result.add(x)
result
iterator test(dir:int):int=
yield 1234
iterator walkGlobKinds (): int =
let dir = 123
let it = mytoSeq(test(dir))
proc main()=
let it = iterator():int=
for path in walkGlobKinds():
yield path
main() refs: #21737 |
@bung87 (collaborator) devel 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) stable 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 2.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 1.6.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 1.4.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 1.2.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 1.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) 0.20.2 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("mytoSeq")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("iter"),
newIdentNode("untyped"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("result"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkCall.newTree(
newIdentNode("typeof"),
newIdentNode("iter")
)
),
newEmptyNode()
)
),
nnkForStmt.newTree(
newIdentNode("x"),
newIdentNode("iter"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("result"),
newIdentNode("add")
),
newIdentNode("x")
)
)
),
newIdentNode("result")
)
),
nnkIteratorDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("dir"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newLit(1234)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("walkGlobKinds"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("dir"),
newEmptyNode(),
newLit(123)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("mytoSeq"),
nnkCall.newTree(
newIdentNode("test"),
newIdentNode("dir")
)
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("main"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode()
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("it"),
newEmptyNode(),
nnkIteratorDef.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int")
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("path"),
nnkCall.newTree(
newIdentNode("walkGlobKinds")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("path")
)
)
)
)
)
)
)
)
),
nnkCall.newTree(
newIdentNode("main")
)
) Stats
🤖 Bug found in |
…access nested in closure
@@ -417,6 +418,9 @@ Consider: | |||
|
|||
""" | |||
|
|||
proc isTypeOf(ident: PIdent; cache: IdentCache): bool = | |||
ident == getIdent(cache, "typeof") or ident == getIdent(cache, "type") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the frontend not transform these into nkType
nodes? It should and would make this far easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting these are just nkTypeOfExpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, even better. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the node processing path goes to here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semMagicAfterOverloadResolution
should turn the magic mType and mTypeOf to nkTypeOfExpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried , didn't found chance transform the node , now only detect via magic, seems sufficient
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
make of nkIdentDefs:
detectCapturedVars(n[0], owner, c)
detectCapturedVars(n[^1], owner, c) |
@bung87 sorry I didn't understand. Does it mean you'll be looking into this? :) |
I've tested locally, |
Indeed, it seems to work, thanks. I'll make a PR now. |
…ested in closure
fix #22548
fix #21737