Skip to content
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

Yielding from var fails with pairs and destructuring #24033

Closed
Nycto opened this issue Aug 30, 2024 · 4 comments · Fixed by #24046
Closed

Yielding from var fails with pairs and destructuring #24033

Nycto opened this issue Aug 30, 2024 · 4 comments · Fixed by #24046
Assignees

Comments

@Nycto
Copy link
Contributor

Nycto commented Aug 30, 2024

Description

I expect the following code to compile:

type Query = ref object

iterator pairs(query: Query): (int, (string, float32)) =
    var output: (int, (string, float32)) = (0, ("foo", 3.14))
    for id in @[ 0, 1, 2 ]:
        output[0] = id
        yield output

for id, (str, num) in Query():
    discard

Nim Version

> nim -v
Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-07-03
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release

Current Output

Error: internal error: /home/nycto/Code/Nim/compiler/transf.nim(383, 7)
Traceback (most recent call last)
/home/nycto/Code/Nim/compiler/nim.nim(169) nim
/home/nycto/Code/Nim/compiler/nim.nim(124) handleCmdLine
/home/nycto/Code/Nim/compiler/main.nim(307) mainCommand
/home/nycto/Code/Nim/compiler/main.nim(274) compileToBackend
/home/nycto/Code/Nim/compiler/main.nim(137) commandCompileToC
/home/nycto/Code/Nim/compiler/pipelines.nim(312) compilePipelineProject
/home/nycto/Code/Nim/compiler/pipelines.nim(232) compilePipelineModule
/home/nycto/Code/Nim/compiler/pipelines.nim(179) processPipelineModule
/home/nycto/Code/Nim/compiler/pipelines.nim(25) processPipeline
/home/nycto/Code/Nim/compiler/cgen.nim(2186) genTopLevelStmt
/home/nycto/Code/Nim/compiler/transf.nim(1244) transformStmt
/home/nycto/Code/Nim/compiler/transf.nim(1160) processTransf
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1028) transform
/home/nycto/Code/Nim/compiler/transf.nim(805) transformFor
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1035) transform
/home/nycto/Code/Nim/compiler/transf.nim(264) transformBlock
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1035) transform
/home/nycto/Code/Nim/compiler/transf.nim(264) transformBlock
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1033) transform
/home/nycto/Code/Nim/compiler/transf.nim(288) transformWhile
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1139) transform
/home/nycto/Code/Nim/compiler/transf.nim(108) transformSons
/home/nycto/Code/Nim/compiler/transf.nim(1105) transform
/home/nycto/Code/Nim/compiler/transf.nim(415) transformYield
/home/nycto/Code/Nim/compiler/msgs.nim(647) asgnTo
/home/nycto/Code/Nim/compiler/msgs.nim(634) internalErrorImpl
/home/nycto/Code/Nim/compiler/msgs.nim(589) liMessage
/home/nycto/Code/Nim/compiler/msgs.nim(433) handleError
/home/nycto/Code/Nim/compiler/msgs.nim(421) quit
FAILURE


### Expected Output

```text
I expect that code to compile

Known Workarounds

This works:

for id, comps in Query():
    discard

Additional Information

No response

@juancarlospaco
Copy link
Collaborator

!nim c

type Query = ref object

iterator pairs(query: Query): (int, (string, float32)) =
    var output: (int, (string, float32)) = (0, ("foo", 3.14))
    for id in @[ 0, 1, 2 ]:
        output[0] = id
        yield output

for id, (str, num) in Query():
    discard

Copy link
Contributor

🐧 Linux bisect by @juancarlospaco (collaborator)
devel 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:02:48
  • Finished 2024-08-30T02:02:48
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkTupleConstr.newTree(
        newIdentNode("int"),
        nnkTupleConstr.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkTupleConstr.newTree(
            newIdentNode("int"),
            nnkTupleConstr.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkTupleConstr.newTree(
            newLit(0),
            nnkTupleConstr.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
stable 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:02:52
  • Finished 2024-08-30T02:02:52
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkTupleConstr.newTree(
        newIdentNode("int"),
        nnkTupleConstr.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkTupleConstr.newTree(
            newIdentNode("int"),
            nnkTupleConstr.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkTupleConstr.newTree(
            newLit(0),
            nnkTupleConstr.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
2.0.8 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:02:52
  • Finished 2024-08-30T02:02:53
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkTupleConstr.newTree(
        newIdentNode("int"),
        nnkTupleConstr.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkTupleConstr.newTree(
            newIdentNode("int"),
            nnkTupleConstr.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkTupleConstr.newTree(
            newLit(0),
            nnkTupleConstr.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
2.0.0 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:02:56
  • Finished 2024-08-30T02:02:56
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkTupleConstr.newTree(
        newIdentNode("int"),
        nnkTupleConstr.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkTupleConstr.newTree(
            newIdentNode("int"),
            nnkTupleConstr.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkTupleConstr.newTree(
            newLit(0),
            nnkTupleConstr.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
1.6.20 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:03:00
  • Finished 2024-08-30T02:03:00
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkTupleConstr.newTree(
        newIdentNode("int"),
        nnkTupleConstr.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkTupleConstr.newTree(
            newIdentNode("int"),
            nnkTupleConstr.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkTupleConstr.newTree(
            newLit(0),
            nnkTupleConstr.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
1.4.8 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:03:02
  • Finished 2024-08-30T02:03:02
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkPar.newTree(
        newIdentNode("int"),
        nnkPar.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkPar.newTree(
            newIdentNode("int"),
            nnkPar.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkPar.newTree(
            newLit(0),
            nnkPar.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
1.2.18 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:03:04
  • Finished 2024-08-30T02:03:04
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkPar.newTree(
        newIdentNode("int"),
        nnkPar.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkPar.newTree(
            newIdentNode("int"),
            nnkPar.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkPar.newTree(
            newLit(0),
            nnkPar.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
1.0.10 👎 FAIL

Output


IR

Compiled filesize 0 (0 bytes)

Stats

  • Started 2024-08-30T02:03:07
  • Finished 2024-08-30T02:03:07
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Query"),
      newEmptyNode(),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          newEmptyNode()
        )
      )
    )
  ),
  nnkIteratorDef.newTree(
    newIdentNode("pairs"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkPar.newTree(
        newIdentNode("int"),
        nnkPar.newTree(
          newIdentNode("string"),
          newIdentNode("float32")
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("query"),
        newIdentNode("Query"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("output"),
          nnkPar.newTree(
            newIdentNode("int"),
            nnkPar.newTree(
              newIdentNode("string"),
              newIdentNode("float32")
            )
          ),
          nnkPar.newTree(
            newLit(0),
            nnkPar.newTree(
              newLit("foo"),
              newLit(3.14)
            )
          )
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("id"),
        nnkPrefix.newTree(
          newIdentNode("@"),
          nnkBracket.newTree(
            newLit(0),
            newLit(1),
            newLit(2)
          )
        ),
        nnkStmtList.newTree(
          nnkAsgn.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("output"),
              newLit(0)
            ),
            newIdentNode("id")
          ),
          nnkYieldStmt.newTree(
            newIdentNode("output")
          )
        )
      )
    )
  ),
  nnkForStmt.newTree(
    newIdentNode("id"),
    nnkVarTuple.newTree(
      newIdentNode("str"),
      newIdentNode("num"),
      newEmptyNode()
    ),
    nnkCall.newTree(
      newIdentNode("Query")
    ),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  )
)
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-08-30T02:02:20Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 21 mins bisecting 8 commits at 0 commits per second

@Nycto
Copy link
Contributor Author

Nycto commented Aug 30, 2024

Might be worth mentioning a similar bug I reported here: #23454

@metagn
Copy link
Collaborator

metagn commented Aug 30, 2024

Unpacking the tuple with let also works

for a in Query().pairs:
  let (id, (str, num)) = a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants