-
-
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
generic types parameter asserts the compiler (#2) #22647
Comments
!nim c proc c0(n: static int): int = 8
proc c1(n: static int): int = n div 2
proc c2(n: static int): int = n * 2
type
a[N: static int] = object
f0 : array[N, int]
b[N: static int] = object
f0 : a[c0(N)] # does not work
f1 : a[c1(N)] # does not work
f2 : a[c2(N)] # does not work
f3 : a[N * 2] # does not work
f4 : a[N] # works
proc p[N: static int](x : a[N]) = echo x.f0[0]
proc p[N: static int](x : b[N]) =
x.f0.p()
x.f1.p()
x.f2.p()
x.f3.p()
x.f4.p()
var x: b[4]
x.p() |
@dagan-deon (none) devel 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) stable 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 2.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 1.6.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 1.4.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 1.2.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 1.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) 0.20.2 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("c0"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newLit(8)
)
),
nnkProcDef.newTree(
newIdentNode("c1"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("div"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkProcDef.newTree(
newIdentNode("c2"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("n"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("n"),
newLit(2)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("a"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("int")
),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("b"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("f0"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c0"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f1"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c1"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f2"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkCall.newTree(
newIdentNode("c2"),
newIdentNode("N")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f3"),
nnkBracketExpr.newTree(
newIdentNode("a"),
nnkInfix.newTree(
newIdentNode("*"),
newIdentNode("N"),
newLit(2)
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("f4"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("a"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
nnkBracketExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newLit(0)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("p"),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newIdentNode("N")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f0")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f1")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f2")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f3")
),
newIdentNode("p")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("f4")
),
newIdentNode("p")
)
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
nnkBracketExpr.newTree(
newIdentNode("b"),
newLit(4)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("x"),
newIdentNode("p")
)
)
) Stats
🤖 Bug found in |
Not an early generic semchecking bug, for some reason |
What is the status/plan for this?
|
I mean it should work. Can't really say when it will be fixed if someone doesn't have a solution, and no one has suggested one. Can't think of a workaround right now either. |
ok thanks. I think I will need to make time to dig into the compiler internals. |
Seems to work now? No idea how |
It compiles but the
And changing it to |
…n fixes (#24005) fixes #4228, fixes #4990, fixes #7006, fixes #7008, fixes #8406, fixes (remaining issue fixed), refs #8545 (works properly now with `cast[static[bool]]` changed to `cast[bool]`), refs #22342 and #22607 (disabled tests added), succeeds #23194 Parameter and return type nodes in generic procs now undergo the same `inGenericContext` treatment that nodes in generic type bodies do. This allows many of the fixes in #22029 and followups to also apply to generic proc signatures. Like #23983 however this needs some more compiler fixes, but this time mostly in `sigmatch` and type instantiations. 1. `tryReadingGenericParam` no longer treats `tyCompositeTypeClass` like a concrete type anymore, so expressions like `Foo.T` where `Foo` is a generic type don't look for a parameter of `Foo` in non-generic code anymore. It also doesn't generate `tyFromExpr` in non-generic code for any generic LHS. This is to handle a very specific case in `asyncmacro` which used `FutureVar.astToStr` where `FutureVar` is generic. 2. The `tryResolvingStaticExpr` call when matching `tyFromExpr` in sigmatch now doesn't consider call nodes in general unresolved, only nodes with `tyFromExpr` type, which is emitted on unresolved expressions by increasing `c.inGenericContext`. `c.inGenericContext == 0` is also now required to attempt instantiating `tyFromExpr`. So matching against `tyFromExpr` in proc signatures works in general now, but I'm speculating it depends on constant folding in `semExpr` for statics to match against it properly. 3. `paramTypesMatch` now doesn't try to change nodes with `tyFromExpr` type into `tyStatic` type when fitting to a static type, because it doesn't need to, they'll be handled the same way (this was a workaround in place of the static type instantiation changes, only one of the fields in the #22647 test doesn't work with it). 4. `tyStatic` matching now uses `inferStaticParam` instead of just range type matching, so `Foo[N div 2]` can infer `N` in the same way `array[N div 2, int]` can. `inferStaticParam` also disabled itself if the inferred static param type already had a node, but `makeStaticExpr` generates static types with unresolved nodes, so we only disable it if it also doesn't have a binding. This might not work very well but the static type instantiation changes should really lower the amount of cases where it's encountered. 5. Static types now undergo type instantiation. Previously the branch for `tyStatic` in `semtypinst` was a no-op, now it acts similarly to instantiating any other type with the following differences: - Other types only need instantiation if `containsGenericType` is true, static types also get instantiated if their value node isn't a literal node. Ideally any value node that is "already evaluated" should be ignored, but I'm not sure of a better way to check this, maybe if `evalConstExpr` emitted a flag. This is purely for optimization though. - After instantiation, `semConstExpr` is called on the value node if `not cl.allowMetaTypes` and the type isn't literally a `static` type. Then the type of the node is set to the base type of the static type to deal with `semConstExpr` stripping abstract types. We need to do this because calls like `foo(N)` where `N` is `static int` and `foo`'s first parameter is just `int` do not generate `tyFromExpr`, they are fully typed and so `makeStaticExpr` is called on them, giving a static type with an unresolved node. (cherry picked from commit 69ea133)
Description
Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-09-05
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 8f7aedb
active boot switches: -d:release
Current Output
Expected Output
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: