Open binhonglee opened 3 years ago
it goes into iterator instantiateGenericParamList
if q.typ.kind != tyCompositeTypeClass:
which is tyGenericParam
, even it pass here it will error type mismatch: got <openArray[T: not char]>
which mismatch to func len*[TOpenArray: openArray|varargs](x: TOpenArray): int {.magic: "LengthOpenArray".}
well, the root cause is proc explicitGenericInstantiation
a.kind
is nkClosedSymChoice
it try instantiate two procs.
@github-actions nim c
type
X*[T] = openArray[T] | varargs[T] | seq[T]
Y*[T] = ref object
dll: T
proc initY*[T](): Y[T] =
new(result)
proc initY*[T](v: X[T]): Y[T] =
new(result)
for e in v:
echo e
var deque: Y[int] = initY[int]()
!nim c
type
X*[T] = openArray[T] | varargs[T] | seq[T]
Y*[T] = ref object
dll: T
proc initY*[T](): Y[T] =
new(result)
proc initY*[T](v: X[T]): Y[T] =
new(result)
for e in v:
echo e
var deque: Y[int] = initY[int]()
0 bytes (0 bytes)
```cpp
```
2023-11-20T14:19:45
2023-11-20T14:19:45
0 bytes (0 bytes)
```cpp
```
2023-11-20T14:19:46
2023-11-20T14:19:46
0 bytes (0 bytes)
```cpp
```
2023-11-20T14:19:46
2023-11-20T14:19:47
0 bytes (0 bytes)
```cpp
```
2023-11-20T14:19:49
2023-11-20T14:19:50
0 bytes (0 bytes)
```cpp
```
2023-11-20T14:19:52
2023-11-20T14:19:52
91.59 Kb (93,784 bytes)
```cpp
#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, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA {
NI dll;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void);
N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(NI x, NI y);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimType NTI__MZHWqsTU9c3Y1Dkj9aubtldA_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
N_LIB_PRIVATE TNimType NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_;
N_LIB_PRIVATE tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* deque__TcgeWyJay7RmcMwxTlkLSA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op) {
tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* a;
a = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)p;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)deque__TcgeWyJay7RmcMwxTlkLSA, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void) {
tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* result;
nimfr_("initY", "/home/runner/work/Nim/Nim/temp.nim");
result = NIM_NIL;
result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*) newObj((&NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_), sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA));
popFrame();
return result;
}
static N_INLINE(NI, pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(NI x, NI y) {
NI result;
nimfr_("+%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/arithm"
"etics.nim");
result = (NI)0;
result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
popFrame();
return result;
}
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
nimfr_("incRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
(*c).refcount = pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system((*c).refcount, ((NI) 8));
popFrame();
}
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/arithm"
"etics.nim");
result = (NI)0;
result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
popFrame();
return result;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
NI T1_;
nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
T1_ = (NI)0;
T1_ = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem(((NI) (ptrdiff_t) (usr)), ((NI) 16));
result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y) {
NIM_BOOL result;
nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/compar"
"isons.nim");
result = (NIM_BOOL)0;
result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
popFrame();
return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
(*c).refcount = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem((*c).refcount, ((NI) 8));
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem((*c).refcount, ((NI) 8));
if (!T3_) goto LA4_;
rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
}
LA4_: ;
popFrame();
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
nimfr_("asgnRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
{
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
if (!!((src == NIM_NIL))) goto LA3_;
T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
T5_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(src);
incRef__AT1eRuflKWyTTBdLjEDZbgsystem(T5_);
}
LA3_: ;
{
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
if (!!(((*dest) == NIM_NIL))) goto LA8_;
T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
T10_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem((*dest));
decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T10_);
}
LA8_: ;
(*dest) = src;
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
tempDatInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
TFrame FR_; FR_.len = 0;
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
}
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
asgnRef((void**) (&deque__TcgeWyJay7RmcMwxTlkLSA), initY__Ja4X7bDn7MSrlTd9anwAaNg());
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
static TNimNode TM__SRd76hP9cMfCzdUO857UhQQ_0[1];
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA);
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.kind = 18;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.base = 0;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.flags = 3;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].kind = 1;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].offset = offsetof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA, dll);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].name = "dll";
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[0];
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.kind = 22;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.base = (&NTI__MZHWqsTU9c3Y1Dkj9aubtldA_);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.flags = 2;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.marker = Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q;
}
```
2023-11-20T14:19:54
2023-11-20T14:19:55
86.62 Kb (88,696 bytes)
```cpp
#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, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA {
NI dll;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* deque__TcgeWyJay7RmcMwxTlkLSA;
TNimType NTI__MZHWqsTU9c3Y1Dkj9aubtldA_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
TNimType NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op) {
tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* a;
a = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)p;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)deque__TcgeWyJay7RmcMwxTlkLSA, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
T1_ = ((NI) 0);
}
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA9_: ;
}
static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void) { tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* result;
nimfr_("initY", "/home/runner/work/Nim/Nim/temp.nim");
result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)0;
result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*) newObj((&NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_), sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA));
popFrame();
return result;
}
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) { nimfr_("incRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
(*c).refcount = (NI)((NU64)((*c).refcount) + (NU64)(((NI) 8)));
popFrame();
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) { tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU64)(((NI) (ptrdiff_t) (usr))) - (NU64)(((NI) 16)))));
popFrame();
return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) { nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) { nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
(*c).refcount = (NI)((NU64)((*c).refcount) - (NU64)(((NI) 8)));
{
if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3_;
rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
}
LA3_: ;
popFrame();
}
static N_INLINE(void, asgnRef)(void** dest, void* src) { nimfr_("asgnRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
{
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
if (!!((src == NIM_NIL))) goto LA3_;
T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
T5_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(src);
incRef__AT1eRuflKWyTTBdLjEDZbgsystem(T5_);
}
LA3_: ;
{
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
if (!!(((*dest) == NIM_NIL))) goto LA8_;
T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
T10_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem((*dest));
decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T10_);
}
LA8_: ;
(*dest) = src;
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
tempDatInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
asgnRef((void**) (&deque__TcgeWyJay7RmcMwxTlkLSA), initY__Ja4X7bDn7MSrlTd9anwAaNg());
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
static TNimNode TM__SRd76hP9cMfCzdUO857UhQQ_0[1];
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA);
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.kind = 18;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.base = 0;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.flags = 3;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].kind = 1;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].offset = offsetof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA, dll);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].name = "dll";
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[0];
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.kind = 22;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.base = (&NTI__MZHWqsTU9c3Y1Dkj9aubtldA_);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.flags = 2;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.marker = Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q;
}
```
2023-11-20T14:19:57
2023-11-20T14:19:57
2020-09-18 04:21:37 -0500
on commit #e56d50d74 with message:
```
fix infinite recursion in typeRel (#15241)
* fix generic constraints
Co-authored-by: James Osborn 11.4.0
14.0.0
18.2
2023-11-20T14:19:16Z
3
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
:robot: Bug found in 19 minutes
bisecting 4744
commits at 243
commits per second
Works now, guessing fixed by #24010?
!nim c
let code = """
type
X*[T] = openArray[T] | varargs[T] | seq[T]
Y*[T] = ref object
dll: T
proc initY*[T](): Y[T] =
new(result)
proc initY*[T](v: X[T]): Y[T] =
new(result)
for e in v:
echo e
var deque: Y[int] = initY[int]()
"""
# foo()
writeFile("test.nim", code)
import std/osproc
let (_, exitCode) = execCmdEx("nim c -r test.nim")
doAssert exitCode != 0
197.50 Kb (202,240 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:01
2024-10-30T11:42:03
1 mins
197.47 Kb (202,208 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:06
2024-10-30T11:42:08
1 mins
197.37 Kb (202,104 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:11
2024-10-30T11:42:12
1 mins
193.19 Kb (197,824 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:15
2024-10-30T11:42:16
1 mins
210.05 Kb (215,088 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:19
2024-10-30T11:42:20
1 mins
215.22 Kb (220,384 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:22
2024-10-30T11:42:23
1 mins
210.74 Kb (215,800 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:25
2024-10-30T11:42:27
1 mins
197.78 Kb (202,528 bytes)
```cpp
#include "nimbase.h"
#include 2024-10-30T11:42:29
2024-10-30T11:42:30
1 mins
2024-09-02 19:22:20 +0300
on commit #71de7fca9 with message:
```
handle explicit generic routine instantiations in sigmatch (#24010)
fixes #16376
The way the compiler handled generic proc instantiations in calls (like
`foo[int](...)`) up to this point was to instantiate `foo[int]`, create
a symbol for the instantiated proc (or a symchoice for multiple procs
excluding ones with mismatching generic param counts), then perform
overload resolution on this symbol/symchoice. The exception to this was
when the called symbol was already a symchoice node, in which case it
wasn't instantiated and overloading was called directly ([these
lines](https://github.com/nim-lang/Nim/blob/b7b1313d21deb687adab2b4a162e716ba561a26b/compiler/semexprs.nim#L3366-L3371)).
This has several problems:
* Templates and macros can't create instantiated symbols, so they
couldn't participate in overloaded explicit generic instantiations,
causing the issue #16376.
* Every single proc that can be instantiated with the given generic
params is fully instantiated including the body. #9997 is about this but
isn't fixed here since the instantiation isn't in a call.
The way overload resolution handles explicit instantiations by itself is
also buggy:
* It doesn't check constraints.
* It allows only partially providing the generic parameters, which makes
sense for implicit generics, but can cause ambiguity in overloading.
Here is how this PR deals with these problems:
* Overload resolution now always handles explicit generic instantiations
in calls, in `initCandidate`, as long as the symbol resolves to a
routine symbol.
* Overload resolution now checks the generic params for constraints and
correct parameter count (ignoring implicit params). If these don't
match, the entire overload is considered as not matching and not
instantiated.
* Special error messages are added for mismatching/missing/extra generic
params. This is almost all of the diff in `semcall`.
* Procs with matching generic parameters now instantiate only the type
of the signature in overload resolution, not the proc itself, which also
works for templates and macros.
Unfortunately we can't entirely remove instantiations because overload
resolution can't handle some cases with uninstantiated types even though
it's resolved in the binding (see the last 2 blocks in
`texplicitgenerics`). There are also some instantiation issues with
default params that #24005 didn't fix but I didn't want this to become
the 3rd huge generics PR in a row so I didn't dive too deep into trying
to fix them. There is still a minor instantiation fix in `semtypinst`
though for subscripts in calls.
Additional changes:
* Overloading of `[]` wasn't documented properly, it somewhat is now
because we need to mention the limitation that it can't be done for
generic procs/types.
* Tests can now enable the new type mismatch errors with just
`-d:testsConciseTypeMismatch` in the command.
Package PRs:
- using fork for now:
[combparser](https://github.com/PMunch/combparser/pull/7) (partial
generic instantiation)
- merged: [cligen](https://github.com/c-blake/cligen/pull/233) (partial
generic instantiation but non-overloaded + template)
- merged: [neo](https://github.com/andreaferretti/neo/pull/56) (trying
to instantiate template with no generic param)
```
The bug is in the files:
```
compiler/ast.nim
compiler/sem.nim
compiler/semcall.nim
compiler/semdata.nim
compiler/semexprs.nim
compiler/seminst.nim
compiler/semtypinst.nim
compiler/sigmatch.nim
doc/manual.md
nimsuggest/tests/tgeneric_highlight.nim
testament/important_packages.nim
tests/ccgbugs/t20141.nim
tests/config.nims
tests/errmsgs/tconcisetypemismatch.nim
tests/errmsgs/tconcisetypemismatch.nims
tests/errmsgs/twrong_explicit_typeargs.nim
tests/errmsgs/twrong_explicit_typeargs_legacy.nim
tests/generics/timplicit_and_explicit.nim
tests/generics/twrong_explicit_typeargs.nim
tests/proc/texplicitgenericcount.nim
tests/proc/texplicitgenericcountverbose.nim
tests/proc/texplicitgenerics.nim
```
The bug can be in the commits:
(Diagnostics sometimes off-by-one).11.4.0
14.0.0
20.4
2024-10-30T11:41:36Z
6
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
:robot: Bug found in 48 mins
bisecting 1019
commits at 21
commits per second
Function
echo
outputs the wrong string.Example
https://play.nim-lang.org/#ix=2FBN
Current Output
Expected Output
(Basically success compilation.)
Additional Information
This is a regression that worked fine on all the previous versions before 1.4.0 (since 0.19.0 according to playground).