-
-
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
Proc returning var T
breaks as typed
macro argument
#16137
Labels
Comments
metagn
changed the title
Proc returning Aug 28, 2023
typed
broken: macro fn(a: typed): untyped = a
breaks codevar T
breaks as typed
macro argument
!nim c # macro fn(a: untyped): untyped = a # ok
macro fn(a: typed): untyped = a # bug
fn:
proc bar(c: var int): var int = c |
🐧 Linux bisect by @ringabout (member)devel 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkMacroDef.newTree(
newIdentNode("fn"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("typed"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("a")
)
),
nnkCall.newTree(
newIdentNode("fn"),
nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkVarTy.newTree(
newIdentNode("int")
),
nnkIdentDefs.newTree(
newIdentNode("c"),
nnkVarTy.newTree(
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("c")
)
)
)
)
) stable 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkMacroDef.newTree(
newIdentNode("fn"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("typed"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("a")
)
),
nnkCall.newTree(
newIdentNode("fn"),
nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkVarTy.newTree(
newIdentNode("int")
),
nnkIdentDefs.newTree(
newIdentNode("c"),
nnkVarTy.newTree(
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("c")
)
)
)
)
) 2.0.0 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkMacroDef.newTree(
newIdentNode("fn"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("typed"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("a")
)
),
nnkCall.newTree(
newIdentNode("fn"),
nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkVarTy.newTree(
newIdentNode("int")
),
nnkIdentDefs.newTree(
newIdentNode("c"),
nnkVarTy.newTree(
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("c")
)
)
)
)
) 1.6.14 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkMacroDef.newTree(
newIdentNode("fn"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("typed"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("a")
)
),
nnkCall.newTree(
newIdentNode("fn"),
nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkVarTy.newTree(
newIdentNode("int")
),
nnkIdentDefs.newTree(
newIdentNode("c"),
nnkVarTy.newTree(
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("c")
)
)
)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize0 bytes (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkMacroDef.newTree(
newIdentNode("fn"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("untyped"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("typed"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("a")
)
),
nnkCall.newTree(
newIdentNode("fn"),
nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkVarTy.newTree(
newIdentNode("int")
),
nnkIdentDefs.newTree(
newIdentNode("c"),
nnkVarTy.newTree(
newIdentNode("int")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
newIdentNode("c")
)
)
)
)
) 1.2.18 👍 OKOutput
IRCompiled filesize86.88 Kb (88,968 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(x, y)
#define nimln_(x, y)
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
}
} Stats
1.0.10 👍 OKOutput
IRCompiled filesize81.98 Kb (83,952 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(x, y)
#define nimln_(x, y)
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
}
} Stats
#fb58066b6 ➡️ 🐛Diagnosticsclyybber introduced a bug at
The bug is in the files:
The bug can be in the commits: (Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typed
broken:macro fn(a: typed): untyped = a
breaks codeExample
Current Output
Expected Output
works
Additional Information
The text was updated successfully, but these errors were encountered: