-
-
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
Inheritance of type in generics passes type constraint but fails in execution #23908
Labels
Comments
!nim c import std/tables
import std/sequtils
type
Component* = object of RootObj
Subtree[T] = OrderedTableRef[ typedesc[T], seq[T] ]
let universe = newOrderedTable[ string, Subtree[ Component ]]()
proc drop*[T: Component]( uuid: string, components: seq[T] ) =
universe.withValue( uuid, branch ):
branch.withValue( T, leaf ):
for component in components:
leaf.del( component )
proc put*[T: Component]( uuid: string, components: seq[T] ) =
let branch = universe.mgetOrPut( uuid, Subtree[T]() )
if not branch.hasKey( T ):
branch[T] = components
else:
branch.withValue( T, leaf ):
for component in components:
if component notin leaf:
leaf.add( component )
type
Dummy = object of Component
value: int
let d0 = Dummy( value: 0 )
echo $d0
put("zero", @[ d0 ]) |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) stable 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 2.0.4 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 2.0.0 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 1.6.20 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 1.2.18 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) 1.0.10 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("tables")
)
),
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("sequtils")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Component")
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("RootObj")
),
newEmptyNode()
)
),
nnkTypeDef.newTree(
newIdentNode("Subtree"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newEmptyNode(),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("OrderedTableRef"),
nnkBracketExpr.newTree(
newIdentNode("typedesc"),
newIdentNode("T")
),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("universe"),
newEmptyNode(),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("newOrderedTable"),
newIdentNode("string"),
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("Component")
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("drop")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("withValue")
),
newIdentNode("uuid"),
newIdentNode("branch"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("del")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("put")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("T"),
newIdentNode("Component"),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("uuid"),
newIdentNode("string"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("components"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("T")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("branch"),
newEmptyNode(),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("universe"),
newIdentNode("mgetOrPut")
),
newIdentNode("uuid"),
nnkCall.newTree(
nnkBracketExpr.newTree(
newIdentNode("Subtree"),
newIdentNode("T")
)
)
)
)
),
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkPrefix.newTree(
newIdentNode("not"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("hasKey")
),
newIdentNode("T")
)
),
nnkStmtList.newTree(
nnkAsgn.newTree(
nnkBracketExpr.newTree(
newIdentNode("branch"),
newIdentNode("T")
),
newIdentNode("components")
)
)
),
nnkElse.newTree(
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("branch"),
newIdentNode("withValue")
),
newIdentNode("T"),
newIdentNode("leaf"),
nnkStmtList.newTree(
nnkForStmt.newTree(
newIdentNode("component"),
newIdentNode("components"),
nnkStmtList.newTree(
nnkIfStmt.newTree(
nnkElifBranch.newTree(
nnkInfix.newTree(
newIdentNode("notin"),
newIdentNode("component"),
newIdentNode("leaf")
),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("leaf"),
newIdentNode("add")
),
newIdentNode("component")
)
)
)
)
)
)
)
)
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Dummy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
nnkOfInherit.newTree(
newIdentNode("Component")
),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("d0"),
newEmptyNode(),
nnkObjConstr.newTree(
newIdentNode("Dummy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(0)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
newIdentNode("d0")
)
),
nnkCall.newTree(
newIdentNode("put"),
newLit("zero"),
nnkPrefix.newTree(
newIdentNode("@"),
nnkBracket.newTree(
newIdentNode("d0")
)
)
)
) Stats
🤖 Bug found in |
Generics are not covariant,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I'm using the playground to try to test out the creation of a simple entity-component relational model in Nim, using generics.
The following code example shows the situation and the test scenario of assigning a single component to an entity.
Nim Version
Using "latest" (via NimPlayground)
Current Output
Expected Output
Possible Solution
No response
Additional Information
As best I can tell from the debugger's output, it's correctly recognizing that I wish to create a
Subtree
ofDummy
(position 3), but fails to assert that Dummy is an object of Component, despite passing the constraint of[T: Component]
to reach line 17.Since the currently available documentation on the nim-lang.org site does not provide guidance on inheritance in generics (or how to explicitly declare this via a type constraint), I would assume that this should resolve normally.
Searching the bug list, this might be related to #88.
The text was updated successfully, but these errors were encountered: