Skip to content
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

nim-devel regression: Nested generic types construction via template cannot instantiate #23310

Closed
jangko opened this issue Feb 15, 2024 · 4 comments · Fixed by #23571
Closed

Comments

@jangko
Copy link
Contributor

jangko commented Feb 15, 2024

Description

import
  std/options

type
  BID = string or uint64

  Future[T] = ref object of RootObj
    internalValue: T

  InternalRaisesFuture[T] = ref object of Future[T]

proc newInternalRaisesFutureImpl[T](): InternalRaisesFuture[T] =
  let fut = InternalRaisesFuture[T]()

template newFuture[T](): auto =
  newInternalRaisesFutureImpl[T]()

proc problematic(blockId: BID): Future[Option[seq[int]]] =
  let resultFuture = newFuture[Option[seq[int]]]()
  return resultFuture

let x = problematic("latest")

Nim Version

Nim Compiler Version 2.1.1 [Windows: amd64]
Compiled at 2024-01-23
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: be0b847
active boot switches: -d:release

Current Output

...\bug.nim(22, 20) template/generic instantiation of `problematic` from here
...\bug.nim(19, 38) Error: cannot instantiate Option [type declared in ...\nim\lib\pure\options.nim(91, 3)]
got: <T>
but expected: <T>

Expected Output

no error

Possible Solution

No response

Additional Information

This code is part of nim-chronos, and it works fine with nim 1.6.18 and nim 2.0.3

@ringabout
Copy link
Member

!nim c

import
  std/options

type
  BID = string or uint64

  Future[T] = ref object of RootObj
    internalValue: T

  InternalRaisesFuture[T] = ref object of Future[T]

proc newInternalRaisesFutureImpl[T](): InternalRaisesFuture[T] =
  let fut = InternalRaisesFuture[T]()

template newFuture[T](): auto =
  newInternalRaisesFutureImpl[T]()

proc problematic(blockId: BID): Future[Option[seq[int]]] =
  let resultFuture = newFuture[Option[seq[int]]]()
  return resultFuture

let x = problematic("latest")

Copy link
Contributor

🐧 Linux bisect by @ringabout (member)
devel 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(15, 20) template/generic instantiation of `problematic` from here
/home/runner/work/Nim/Nim/temp.nim(13, 38) Error: cannot instantiate Option [type declared in /home/runner/.choosenim/toolchains/nim-#devel/lib/pure/options.nim(91, 3)]
got: <T>
but expected: <T>
assertions.nim(34)       raiseAssert
Error: unhandled exception: errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-02-19T12:16:29
  • Finished 2024-02-19T12:16:29
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
stable 👍 OK

Output


IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:30
  • Finished 2024-02-19T12:16:31
  • Duration
2.0.0 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(15, 20) template/generic instantiation of `problematic` from here
/home/runner/work/Nim/Nim/temp.nim(13, 38) Error: cannot instantiate Option [type declared in /home/runner/.choosenim/toolchains/nim-2.0.0/lib/pure/options.nim(90, 3)]
got: <T>
but expected: <T>
assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:33
  • Finished 2024-02-19T12:16:33
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
1.6.14 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(13, 22) Error: 'newFuture' has unspecified generic parameters
fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:36
  • Finished 2024-02-19T12:16:36
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(13, 22) Error: 'newFuture' has unspecified generic parameters

IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:39
  • Finished 2024-02-19T12:16:39
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
1.2.18 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(13, 22) Error: 'newFuture' has unspecified generic parameters

IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:41
  • Finished 2024-02-19T12:16:41
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
1.0.10 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(13, 22) Error: 'newFuture' has unspecified generic parameters

IR

Compiled filesize 91.48 Kb (93,680 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
struct RootObj {
TNimTypeV2* m_type;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow {
 tySequence__qwqHTkRvwhrRyENtudHQ7g val;
 NIM_BOOL has;
};
struct tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ {
RootObj Sup;
 tyObject_Option__9cGajnYE9arR7Hmr1TPvw5ow internalValue;
};
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg {
tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ Sup;
};
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
static N_INLINE(void, nimMarkCyclic)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_;
static const struct {
NI cap; NIM_CHAR data[6+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 6 | NIM_STRLIT_FLAG, "latest" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {6, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
N_LIB_PRIVATE tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* x__temp_u286;
static NIM_CONST NU32 TM__SRd76hP9cMfCzdUO857UhQQ_2[3] = {3701606400, 3362939648, 281895168};
N_LIB_PRIVATE TNimTypeV2 NTIv2__JRDNYXKG9avPzoSh5WuleFg_ = {.destructor = (void*)rttiDestroy__temp_u288, .size = sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .align = (NI16) NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), .depth = 2, .display = TM__SRd76hP9cMfCzdUO857UhQQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u82)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0) {
 if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc(dest_p0.p, NIM_ALIGNOF(NI));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u64)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 eqdestroy___temp_u82((*dest_p0).Sup.internalValue.val);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__temp_u288)(void* dest_p0) {
 eqdestroy___temp_u64(((tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) (dest_p0)));
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u44)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*, newInternalRaisesFutureImpl__temp_u35)(void) {
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* fut;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* T1_;
 nimfr_("newInternalRaisesFutureImpl", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 fut = NIM_NIL;
 T1_ = NIM_NIL;
 T1_ = (tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg*) nimNewObj(sizeof(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg), NIM_ALIGNOF(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg));
 (*T1_).Sup.Sup.m_type = (&NTIv2__JRDNYXKG9avPzoSh5WuleFg_);
 fut = T1_;
 eqdestroy___temp_u44(fut);
 popFrame();
 return result;
}
static N_INLINE(void, nimMarkCyclic)(void* p_p0) {
 nimfr_("nimMarkCyclic", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
 popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u41)(tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg** dest_p0) {
 (*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ*, problematic__temp_u28)(NimStringV2 blockId_p0) {
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* result;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* resultFuture;
 tyObject_InternalRaisesFuturecolonObjectType___JRDNYXKG9avPzoSh5WuleFg* blitTmp;
NIM_BOOL* nimErr_;
 nimfr_("problematic", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
 result = NIM_NIL;
 resultFuture = NIM_NIL;
 resultFuture = newInternalRaisesFutureImpl__temp_u35();
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 blitTmp = resultFuture;
 nimMarkCyclic(resultFuture);
 eqwasMoved___temp_u41(&resultFuture);
 result = &blitTmp->Sup;
 eqdestroy___temp_u44(resultFuture);
 goto BeforeRet_;
 {
  LA1_:;
 }
 {
  eqdestroy___temp_u44(resultFuture);
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u238)(tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose(dest_p0);
 }
LA4_: ;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 tyObject_FuturecolonObjectType___PMhyY0zpNCA9c9amRui9aYsmQ* T1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 T1_ = NIM_NIL;
 T1_ = problematic__temp_u28(TM__SRd76hP9cMfCzdUO857UhQQ_5);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 x__temp_u286 = T1_;
 eqdestroy___temp_u238(x__temp_u286);
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-02-19T12:16:43
  • Finished 2024-02-19T12:16:43
  • Duration

AST

nnkStmtList.newTree(
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("options")
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("BID"),
      newEmptyNode(),
      nnkInfix.newTree(
        newIdentNode("or"),
        newIdentNode("string"),
        newIdentNode("uint64")
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("Future"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            newIdentNode("RootObj")
          ),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("internalValue"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("InternalRaisesFuture"),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          nnkOfInherit.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("Future"),
              newIdentNode("T")
            )
          ),
          newEmptyNode()
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("newInternalRaisesFutureImpl"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("InternalRaisesFuture"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("fut"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("InternalRaisesFuture"),
              newIdentNode("T")
            )
          )
        )
      )
    )
  ),
  nnkTemplateDef.newTree(
    newIdentNode("newFuture"),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("auto")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("newInternalRaisesFutureImpl"),
          newIdentNode("T")
        )
      )
    )
  ),
  nnkProcDef.newTree(
    newIdentNode("problematic"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Future"),
        nnkBracketExpr.newTree(
          newIdentNode("Option"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          )
        )
      ),
      nnkIdentDefs.newTree(
        newIdentNode("blockId"),
        newIdentNode("BID"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkLetSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("resultFuture"),
          newEmptyNode(),
          nnkCall.newTree(
            nnkBracketExpr.newTree(
              newIdentNode("newFuture"),
              nnkBracketExpr.newTree(
                newIdentNode("Option"),
                nnkBracketExpr.newTree(
                  newIdentNode("seq"),
                  newIdentNode("int")
                )
              )
            )
          )
        )
      ),
      nnkReturnStmt.newTree(
        newIdentNode("resultFuture")
      )
    )
  ),
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("x"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("problematic"),
        newLit("latest")
      )
    )
  )
)
#941659581 ➡️ 🐛

Diagnostics

metagn introduced a bug at 2023-12-18 19:40:30 +0300 on commit #941659581 with message:

allow replacing captured syms in macro calls in generics (#23091)

fixes #22605, separated from #22744

This marks symbol captures in macro calls in generic contexts as
`nfOpenSym`, which means if there is a new symbol in the local
instantiatied body during instantiation time, this symbol replaces the
captured symbol. We have to be careful not to consider symbols outside
of the instantiation body during instantiation, because this will leak
symbols from the instantiation context scope rather than the original
declaration scope. This is done by checking if the local context owner
(maybe should be the symbol of the proc currently getting instantiated
instead? not sure how to get this) is the same as or a parent owner of
the owner of the replacement candidate symbol.

This solution is distinct from the symchoice mechanisms which we
originally assumed had to be related, if this assumption was wrong it
would explain why this solution took so long to arrive at.

The bug is in the files:

compiler/ast.nim
compiler/ic/ic.nim
compiler/semexprs.nim
compiler/semgnrc.nim
tests/generics/tmacroinjectedsym.nim

The bug can be in the commits:

(Diagnostics sometimes off-by-one).

Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 19.0
  • Created 2024-02-19T12:15:57Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 10 minutes bisecting 478 commits at 45 commits per second

@metagn
Copy link
Collaborator

metagn commented Apr 24, 2024

Did not see this, sorry, I have an idea for fixing it (T should be left alone since it is a template generic param) but I can't exactly reason why this code is affected (which T is replacing it?)

@jangko
Copy link
Contributor Author

jangko commented May 3, 2024

The problem is in this proc

proc problematic(blockId: BID): Future[Option[seq[int]]] =
  let resultFuture = newFuture[Option[seq[int]]]()
  return resultFuture

if blockId: BID is not generic, e.g. blockId: string, it will be okay. But because BID is a string or uint64, the above happen.

metagn added a commit to metagn/Nim that referenced this issue May 4, 2024
Araq pushed a commit that referenced this issue May 8, 2024
fixes #23568, fixes #23310

In #23091 `semFinishOperands` was changed to not be called for `mArrGet`
and `mArrPut`, presumably in preparation for #23188 (not sure why it was
needed in #23091, maybe they got mixed together), since the compiler
handles these later and needs the first argument to not be completely
"typed" since brackets can serve as explicit generic instantiations in
which case the first argument would have to be an unresolved generic
proc (not accepted by `finishOperand`).

In this PR we just make it so `mArrGet` and `mArrPut` specifically skip
calling `finishOperand` on the first argument. This way the generic
arguments in the explicit instantiation get typed, but not the
unresolved generic proc.
narimiran pushed a commit that referenced this issue May 8, 2024
fixes #23568, fixes #23310

In #23091 `semFinishOperands` was changed to not be called for `mArrGet`
and `mArrPut`, presumably in preparation for #23188 (not sure why it was
needed in #23091, maybe they got mixed together), since the compiler
handles these later and needs the first argument to not be completely
"typed" since brackets can serve as explicit generic instantiations in
which case the first argument would have to be an unresolved generic
proc (not accepted by `finishOperand`).

In this PR we just make it so `mArrGet` and `mArrPut` specifically skip
calling `finishOperand` on the first argument. This way the generic
arguments in the explicit instantiation get typed, but not the
unresolved generic proc.

(cherry picked from commit 09bd9d0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants