-
-
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
IndexDefect thrown when destructuring a lent value #23454
Comments
!nim c type
Letter = enum A
LetterPairs = object
values: seq[(Letter, string)]
iterator items(list: var LetterPairs): lent (Letter, string) =
for item in list.values:
yield item
var instance = LetterPairs(values: @[ (A, "foo") ])
for (a, _) in instance:
case a
of A: discard |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkTupleConstr.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) stable 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkTupleConstr.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) 2.0.2 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkTupleConstr.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) 1.6.14 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkTupleConstr.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkTupleConstr.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkPar.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) 1.2.18 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkPar.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) 1.0.10 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Letter"),
newEmptyNode(),
nnkEnumTy.newTree(
newEmptyNode(),
newIdentNode("A")
)
),
nnkTypeDef.newTree(
newIdentNode("LetterPairs"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("values"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
newEmptyNode()
)
)
)
)
),
nnkIteratorDef.newTree(
newIdentNode("items"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkCommand.newTree(
newIdentNode("lent"),
nnkPar.newTree(
newIdentNode("Letter"),
newIdentNode("string")
)
),
nnkIdentDefs.newTree(
newIdentNode("list"),
nnkVarTy.newTree(
newIdentNode("LetterPairs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("item"),
nnkDotExpr.newTree(
newIdentNode("list"),
newIdentNode("values")
),
nnkStmtList.newTree(
nnkYieldStmt.newTree(
newIdentNode("item")
)
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("instance"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("LetterPairs"),
nnkExprColonExpr.newTree(
newIdentNode("values"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
nnkPar.newTree(
newIdentNode("A"),
newLit("foo")
)
)
)
)
)
)
),
nnkForStmt.newTree(
nnkVarTuple.newTree(
newIdentNode("a"),
newIdentNode("_"),
newEmptyNode()
),
newIdentNode("instance"),
nnkStmtList.newTree(
nnkCaseStmt.newTree(
newIdentNode("a"),
nnkOfBranch.newTree(
newIdentNode("A"),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
)
)
)
)
) Stats
🤖 Bug found in |
ringabout
added a commit
that referenced
this issue
Mar 29, 2024
ringabout
added a commit
that referenced
this issue
Aug 15, 2024
ringabout
added a commit
that referenced
this issue
Aug 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code throws a compiler error, when it is expected to work:
Nim Version
And also:
Current Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: