-
-
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
Using another parameter as default value to a template parameter cause internal error #23506
Labels
Comments
!nim c template foo(x: int; y = x) =
echo x, y
foo(1) |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) stable 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) 2.0.2 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) 1.6.14 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) 1.2.18 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) 1.0.10 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTemplateDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("y"),
newEmptyNode(),
newIdentNode("x")
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("x"),
newIdentNode("y")
)
)
),
nnkCall.newTree(
newIdentNode("foo"),
newLit(1)
)
) Stats
🤖 Bug found in |
metagn
added a commit
to metagn/Nim
that referenced
this issue
Sep 6, 2024
metagn
added a commit
to metagn/Nim
that referenced
this issue
Sep 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Defining a template with a parameter with a default value that is another parameter cause internal error.
Example code:
Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-16
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 549ef24
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: