diff options
-rw-r--r-- | compiler/ast.nim | 7 | ||||
-rw-r--r-- | compiler/canonicalizer.nim | 18 | ||||
-rw-r--r-- | compiler/cgen.nim | 2 | ||||
-rw-r--r-- | compiler/cgmeth.nim | 5 | ||||
-rw-r--r-- | compiler/importer.nim | 2 | ||||
-rw-r--r-- | compiler/nversion.nim | 2 | ||||
-rw-r--r-- | compiler/options.nim | 6 | ||||
-rw-r--r-- | compiler/pragmas.nim | 2 | ||||
-rw-r--r-- | compiler/rodread.nim | 93 | ||||
-rw-r--r-- | compiler/rodwrite.nim | 111 | ||||
-rw-r--r-- | lib/system.nim | 3 | ||||
-rw-r--r-- | tests/rodfiles/amethods.nim | 4 | ||||
-rw-r--r-- | tests/rodfiles/gtkex1.nim | 6 | ||||
-rw-r--r-- | tests/rodfiles/gtkex2.nim | 6 | ||||
-rw-r--r-- | tests/rodfiles/int2bool.nim | 1 | ||||
-rw-r--r-- | tests/testament/backend.nim | 1 | ||||
-rw-r--r-- | tests/testament/categories.nim | 36 |
17 files changed, 208 insertions, 97 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index d301417ac..347060248 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -725,7 +725,7 @@ type s*: TStorageLoc flags*: TLocFlags # location's flags t*: PType # type of location - r*: Rope # rope value of location (code generators) + r*: Rope # rope value of location (code generators) # ---------------- end of backend information ------------------------------ @@ -743,10 +743,6 @@ type TInstantiation* = object sym*: PSym concreteTypes*: seq[PType] - usedBy*: seq[int32] # list of modules using the generic - # needed in caas mode for purging the cache - # XXX: it's possible to switch to a - # simple ref count here compilesId*: CompilesId PInstantiation* = ref TInstantiation @@ -764,7 +760,6 @@ type case kind*: TSymKind of skType, skGenericParam: typeInstCache*: seq[PType] - typScope*: PScope of routineKinds: procInstCache*: seq[PInstantiation] gcUnsafetyReason*: PSym # for better error messages wrt gcsafe diff --git a/compiler/canonicalizer.nim b/compiler/canonicalizer.nim index 089bce302..2abe0a0e6 100644 --- a/compiler/canonicalizer.nim +++ b/compiler/canonicalizer.nim @@ -383,18 +383,28 @@ proc createDb() = interfHash varchar(256) not null, fullHash varchar(256) not null, - created timestamp not null default (DATETIME('now')), + created timestamp not null default (DATETIME('now')) );""") db.exec(sql""" + create table if not exists Backend( + id integer primary key, + strongdeps varchar(max) not null, + weakdeps varchar(max) not null, + header varchar(max) not null, + code varchar(max) not null + ) + create table if not exists Symbol( id integer primary key, module integer not null, + backend integer not null, name varchar(max) not null, data varchar(max) not null, created timestamp not null default (DATETIME('now')), - foreign key (module) references module(id) + foreign key (module) references Module(id), + foreign key (backend) references Backend(id) );""") db.exec(sql""" @@ -409,7 +419,3 @@ proc createDb() = );""") - #db.exec(sql""" - # --create unique index if not exists TsstNameIx on TestResult(name); - # """, []) - diff --git a/compiler/cgen.nim b/compiler/cgen.nim index b68bf64bb..42883b590 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -987,7 +987,7 @@ proc genInitCode(m: BModule) = var procname = makeCString(m.module.name.s) add(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename)) else: - add(prc, ~"\tTFrame F; FR.len = 0;$N") + add(prc, ~"\tTFrame FR; FR.len = 0;$N") add(prc, genSectionStart(cpsInit)) add(prc, m.preInitProc.s(cpsInit)) diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index 624c5b183..bcf0b535b 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -145,15 +145,16 @@ proc fixupDispatcher(meth, disp: PSym) = disp.typ.lockLevel = meth.typ.lockLevel proc methodDef*(s: PSym, fromCache: bool) = - var L = len(gMethods) + let L = len(gMethods) var witness: PSym for i in countup(0, L - 1): - var disp = gMethods[i].dispatcher + let disp = gMethods[i].dispatcher case sameMethodBucket(disp, s) of Yes: add(gMethods[i].methods, s) attachDispatcher(s, lastSon(disp.ast)) fixupDispatcher(s, disp) + #echo "fixup ", disp.name.s, " ", disp.id when useEffectSystem: checkMethodEffects(disp, s) if sfBase in s.flags and gMethods[i].methods[0] != s: # already exists due to forwarding definition? diff --git a/compiler/importer.nim b/compiler/importer.nim index dd2c4d954..7e7130b85 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -163,7 +163,7 @@ proc myImportModule(c: PContext, n: PNode): PSym = var f = checkModuleName(n) if f != InvalidFileIDX: result = importModuleAs(n, gImportModule(c.module, f)) - if result.info.fileIndex == n.info.fileIndex: + if result.info.fileIndex == c.module.info.fileIndex: localError(n.info, errGenerated, "A module cannot import itself") if sfDeprecated in result.flags: message(n.info, warnDeprecated, result.name.s) diff --git a/compiler/nversion.nim b/compiler/nversion.nim index adeb0fb6d..d69e1e553 100644 --- a/compiler/nversion.nim +++ b/compiler/nversion.nim @@ -13,5 +13,5 @@ const MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets? VersionAsString* = system.NimVersion - RodFileVersion* = "1215" # modify this if the rod-format changes! + RodFileVersion* = "1221" # modify this if the rod-format changes! diff --git a/compiler/options.nim b/compiler/options.nim index a5154cb48..7cf707945 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -70,6 +70,12 @@ type # please make sure we have under 32 options optExcessiveStackTrace # fully qualified module filenames TGlobalOptions* = set[TGlobalOption] + +const + harmlessOptions* = {optForceFullMake, optNoLinking, optReportConceptFailures, + optRun, optUseColors, optStdout} + +type TCommands* = enum # Nim's commands # **keep binary compatible** cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index db5f8e727..9a12fa7fe 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -567,11 +567,13 @@ proc deprecatedStmt(c: PContext; pragma: PNode) = for n in pragma: if n.kind in {nkExprColonExpr, nkExprEqExpr}: let dest = qualifiedLookUp(c, n[1], {checkUndeclared}) + assert dest != nil let src = considerQuotedIdent(n[0]) let alias = newSym(skAlias, src, dest, n[0].info) incl(alias.flags, sfExported) if sfCompilerProc in dest.flags: markCompilerProc(alias) addInterfaceDecl(c, alias) + n.sons[1] = newSymNode(dest) else: localError(n.info, "key:value pair expected") diff --git a/compiler/rodread.nim b/compiler/rodread.nim index 004b30b41..679e7ba15 100644 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -145,13 +145,7 @@ type PRodReader* = ref TRodReader -var rodCompilerprocs*: TStrTable - -proc handleSymbolFile*(module: PSym): PRodReader -# global because this is needed by magicsys -proc loadInitSection*(r: PRodReader): PNode - -# implementation +var rodCompilerprocs*: TStrTable # global because this is needed by magicsys proc rawLoadStub(s: PSym) @@ -206,7 +200,7 @@ proc decodeNodeLazyBody(r: PRodReader, fInfo: TLineInfo, var id = decodeVInt(r.s, r.pos) result.typ = rrGetType(r, id, result.info) case result.kind - of nkCharLit..nkInt64Lit: + of nkCharLit..nkUInt64Lit: if r.s[r.pos] == '!': inc(r.pos) result.intVal = decodeVBiggestInt(r.s, r.pos) @@ -324,6 +318,29 @@ proc decodeType(r: PRodReader, info: TLineInfo): PType = result.align = decodeVInt(r.s, r.pos).int16 else: result.align = 2 + + if r.s[r.pos] == '\14': + inc(r.pos) + result.lockLevel = decodeVInt(r.s, r.pos).TLockLevel + else: + result.lockLevel = UnspecifiedLockLevel + + if r.s[r.pos] == '\15': + inc(r.pos) + result.destructor = rrGetSym(r, decodeVInt(r.s, r.pos), info) + if r.s[r.pos] == '\16': + inc(r.pos) + result.deepCopy = rrGetSym(r, decodeVInt(r.s, r.pos), info) + if r.s[r.pos] == '\17': + inc(r.pos) + result.assignment = rrGetSym(r, decodeVInt(r.s, r.pos), info) + while r.s[r.pos] == '\18': + inc(r.pos) + let x = decodeVInt(r.s, r.pos) + doAssert r.s[r.pos] == '\19' + inc(r.pos) + let y = rrGetSym(r, decodeVInt(r.s, r.pos), info) + result.methods.safeAdd((x, y)) decodeLoc(r, result.loc, info) while r.s[r.pos] == '^': inc(r.pos) @@ -349,6 +366,22 @@ proc decodeLib(r: PRodReader, info: TLineInfo): PLib = inc(r.pos) result.path = decodeNode(r, info) +proc decodeInstantiations(r: PRodReader; info: TLineInfo; + s: var seq[PInstantiation]) = + while r.s[r.pos] == '\15': + inc(r.pos) + var ii: PInstantiation + new ii + ii.sym = rrGetSym(r, decodeVInt(r.s, r.pos), info) + ii.concreteTypes = @[] + while r.s[r.pos] == '\17': + inc(r.pos) + ii.concreteTypes.add rrGetType(r, decodeVInt(r.s, r.pos), info) + if r.s[r.pos] == '\20': + inc(r.pos) + ii.compilesId = decodeVInt(r.s, r.pos) + s.safeAdd ii + proc decodeSym(r: PRodReader, info: TLineInfo): PSym = var id: int @@ -423,6 +456,27 @@ proc decodeSym(r: PRodReader, info: TLineInfo): PSym = if r.s[r.pos] == '#': inc(r.pos) result.constraint = decodeNode(r, unknownLineInfo()) + case result.kind + of skType, skGenericParam: + while r.s[r.pos] == '\14': + inc(r.pos) + result.typeInstCache.safeAdd rrGetType(r, decodeVInt(r.s, r.pos), result.info) + of routineKinds: + decodeInstantiations(r, result.info, result.procInstCache) + if r.s[r.pos] == '\16': + inc(r.pos) + result.gcUnsafetyReason = rrGetSym(r, decodeVInt(r.s, r.pos), result.info) + of skModule, skPackage: + decodeInstantiations(r, result.info, result.usedGenerics) + of skLet, skVar, skField, skForVar: + if r.s[r.pos] == '\18': + inc(r.pos) + result.guard = rrGetSym(r, decodeVInt(r.s, r.pos), result.info) + if r.s[r.pos] == '\19': + inc(r.pos) + result.bitsize = decodeVInt(r.s, r.pos).int16 + else: discard + if r.s[r.pos] == '(': if result.kind in routineKinds: result.ast = decodeNodeLazyBody(r, result.info, result) @@ -566,7 +620,8 @@ proc processRodFile(r: PRodReader, hash: SecureHash) = of "GOPTIONS": inc(r.pos) # skip ':' var dep = cast[TGlobalOptions](int32(decodeVInt(r.s, r.pos))) - if gGlobalOptions != dep: r.reason = rrOptions + if gGlobalOptions-harmlessOptions != dep-harmlessOptions: + r.reason = rrOptions of "CMD": inc(r.pos) # skip ':' var dep = cast[TCommands](int32(decodeVInt(r.s, r.pos))) @@ -580,14 +635,14 @@ proc processRodFile(r: PRodReader, hash: SecureHash) = if not condsyms.isDefined(getIdent(w)): r.reason = rrDefines #MessageOut('not defined, but should: ' + w); if r.s[r.pos] == ' ': inc(r.pos) - if (d != countDefinedSymbols()): r.reason = rrDefines + if d != countDefinedSymbols(): r.reason = rrDefines of "FILES": inc(r.pos, 2) # skip "(\10" inc(r.line) while r.s[r.pos] != ')': - let relativePath = decodeStr(r.s, r.pos) - let resolvedPath = relativePath.findModule(r.origFile) - let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath + let finalPath = decodeStr(r.s, r.pos) + #let resolvedPath = relativePath.findModule(r.origFile) + #let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath r.files.add(finalPath.fileInfoIdx) inc(r.pos) # skip #10 inc(r.line) @@ -683,8 +738,11 @@ proc newRodReader(modfilename: string, hash: SecureHash, if version != RodFileVersion: # since ROD files are only for caching, no backwards compatibility is # needed + #echo "expected version ", version, " ", RodFileVersion + result.memfile.close result = nil else: + result.memfile.close result = nil proc rrGetType(r: PRodReader, id: int, info: TLineInfo): PType = @@ -762,7 +820,7 @@ proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym = result = decodeSymSafePos(r, d, info) if result != nil and result.kind == skStub: rawLoadStub(result) -proc loadInitSection(r: PRodReader): PNode = +proc loadInitSection*(r: PRodReader): PNode = if r.initIdx == 0 or r.dataIdx == 0: internalError("loadInitSection") var oldPos = r.pos r.pos = r.initIdx @@ -818,9 +876,8 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = var hash = getHash(fileIdx) gMods[fileIdx].reason = rrNone # we need to set it here to avoid cycles result = rrNone - var r: PRodReader = nil var rodfile = toGeneratedFile(filename.withPackageName, RodExt) - r = newRodReader(rodfile, hash, fileIdx) + var r = newRodReader(rodfile, hash, fileIdx) if r == nil: result = (if existsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist) else: @@ -847,7 +904,7 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = gMods[fileIdx].rd = r gMods[fileIdx].reason = result # now we know better -proc handleSymbolFile(module: PSym): PRodReader = +proc handleSymbolFile*(module: PSym): PRodReader = let fileIdx = module.fileIdx if optSymbolFiles notin gGlobalOptions: module.id = getID() @@ -923,7 +980,7 @@ proc writeNode(f: File; n: PNode) = f.write('^') f.write(n.typ.id) case n.kind - of nkCharLit..nkInt64Lit: + of nkCharLit..nkUInt64Lit: if n.intVal != 0: f.write('!') f.write(n.intVal) diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim index d48a9ba40..addbdade6 100644 --- a/compiler/rodwrite.nim +++ b/compiler/rodwrite.nim @@ -16,8 +16,6 @@ import condsyms, ropes, idents, securehash, rodread, passes, importer, idgen, rodutils -# implementation - type TRodWriter = object of TPassContext module: PSym @@ -39,13 +37,6 @@ type PRodWriter = ref TRodWriter -proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter -proc addModDep(w: PRodWriter, dep: string) -proc addInclDep(w: PRodWriter, dep: string) -proc addInterfaceSym(w: PRodWriter, s: PSym) -proc addStmt(w: PRodWriter, n: PNode) -proc writeRod(w: PRodWriter) - proc getDefines(): string = result = "" for d in definedSymbolNames(): @@ -83,19 +74,20 @@ proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter = result.converters = "" result.methods = "" result.init = "" - result.origFile = module.info.toFilename + result.origFile = module.info.toFullPath result.data = newStringOfCap(12_000) -proc addModDep(w: PRodWriter, dep: string) = +proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) = if w.modDeps.len != 0: add(w.modDeps, ' ') - encodeVInt(fileIdx(w, dep), w.modDeps) + let resolved = dep.findModule(info.toFullPath) + encodeVInt(fileIdx(w, resolved), w.modDeps) const rodNL = "\x0A" -proc addInclDep(w: PRodWriter, dep: string) = - var resolved = dep.findModule(w.module.info.toFullPath) - encodeVInt(fileIdx(w, dep), w.inclDeps) +proc addInclDep(w: PRodWriter, dep: string; info: TLineInfo) = + let resolved = dep.findModule(info.toFullPath) + encodeVInt(fileIdx(w, resolved), w.inclDeps) add(w.inclDeps, " ") encodeStr($secureHashFile(resolved), w.inclDeps) add(w.inclDeps, rodNL) @@ -108,6 +100,10 @@ proc pushType(w: PRodWriter, t: PType) = proc pushSym(w: PRodWriter, s: PSym) = # check so that the stack does not grow too large: if iiTableGet(w.index.tab, s.id) == InvalidKey: + when false: + if s.kind == skMethod: + echo "encoding ", s.id, " ", s.name.s + writeStackTrace() w.sstack.add(s) proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, @@ -127,7 +123,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, result.add(',') encodeVInt(n.info.line, result) result.add(',') - encodeVInt(fileIdx(w, toFilename(n.info)), result) + encodeVInt(fileIdx(w, toFullPath(n.info)), result) elif fInfo.line != n.info.line: result.add('?') encodeVInt(n.info.col, result) @@ -147,7 +143,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, encodeVInt(n.typ.id, result) pushType(w, n.typ) case n.kind - of nkCharLit..nkInt64Lit: + of nkCharLit..nkUInt64Lit: if n.intVal != 0: result.add('!') encodeVBiggestInt(n.intVal, result) @@ -229,6 +225,27 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) = if t.align != 2: add(result, '=') encodeVInt(t.align, result) + if t.lockLevel.ord != UnspecifiedLockLevel.ord: + add(result, '\14') + encodeVInt(t.lockLevel.int16, result) + if t.destructor != nil and t.destructor.id != 0: + add(result, '\15') + encodeVInt(t.destructor.id, result) + pushSym(w, t.destructor) + if t.deepCopy != nil: + add(result, '\16') + encodeVInt(t.deepcopy.id, result) + pushSym(w, t.deepcopy) + if t.assignment != nil: + add(result, '\17') + encodeVInt(t.assignment.id, result) + pushSym(w, t.assignment) + for i, s in items(t.methods): + add(result, '\18') + encodeVInt(i, result) + add(result, '\19') + encodeVInt(s.id, result) + pushSym(w, s) encodeLoc(w, t.loc, result) for i in countup(0, sonsLen(t) - 1): if t.sons[i] == nil: @@ -246,6 +263,19 @@ proc encodeLib(w: PRodWriter, lib: PLib, info: TLineInfo, result: var string) = add(result, '|') encodeNode(w, info, lib.path, result) +proc encodeInstantiations(w: PRodWriter; s: seq[PInstantiation]; + result: var string) = + for t in s: + result.add('\15') + encodeVInt(t.sym.id, result) + pushSym(w, t.sym) + for tt in t.concreteTypes: + result.add('\17') + encodeVInt(tt.id, result) + pushType(w, tt) + result.add('\20') + encodeVInt(t.compilesId, result) + proc encodeSym(w: PRodWriter, s: PSym, result: var string) = if s == nil: # nil nodes have to be stored too: @@ -266,7 +296,7 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) = result.add(',') if s.info.line != -1'i16: encodeVInt(s.info.line, result) result.add(',') - encodeVInt(fileIdx(w, toFilename(s.info)), result) + encodeVInt(fileIdx(w, toFullPath(s.info)), result) if s.owner != nil: result.add('*') encodeVInt(s.owner.id, result) @@ -291,6 +321,31 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) = if s.constraint != nil: add(result, '#') encodeNode(w, unknownLineInfo(), s.constraint, result) + case s.kind + of skType, skGenericParam: + for t in s.typeInstCache: + result.add('\14') + encodeVInt(t.id, result) + pushType(w, t) + of routineKinds: + encodeInstantiations(w, s.procInstCache, result) + if s.gcUnsafetyReason != nil: + result.add('\16') + encodeVInt(s.gcUnsafetyReason.id, result) + pushSym(w, s.gcUnsafetyReason) + of skModule, skPackage: + encodeInstantiations(w, s.usedGenerics, result) + # we don't serialize: + #tab*: TStrTable # interface table for modules + of skLet, skVar, skField, skForVar: + if s.guard != nil: + result.add('\18') + encodeVInt(s.guard.id, result) + pushSym(w, s.guard) + if s.bitsize != 0: + result.add('\19') + encodeVInt(s.bitsize, result) + else: discard # lazy loading will soon reload the ast lazily, so the ast needs to be # the last entry of a symbol: if s.ast != nil: @@ -298,16 +353,6 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) = # it is not necessary, but Nim's heavy compile-time evaluation features # make that unfeasible nowadays: encodeNode(w, s.info, s.ast, result) - when false: - var codeAst: PNode = nil - if not astNeeded(s): - codeAst = s.ast.sons[codePos] - # ugly hack to not store the AST: - s.ast.sons[codePos] = ast.emptyNode - encodeNode(w, s.info, s.ast, result) - if codeAst != nil: - # resore the AST: - s.ast.sons[codePos] = codeAst proc addToIndex(w: var TIndex, key, val: int) = if key - w.lastIdxKey == 1: @@ -562,13 +607,15 @@ proc process(c: PPassContext, n: PNode): PNode = # addInterfaceSym(w, a.sons[j].sym); # end of nkImportStmt: - for i in countup(0, sonsLen(n) - 1): addModDep(w, getModuleName(n.sons[i])) + for i in countup(0, sonsLen(n) - 1): + addModDep(w, getModuleName(n.sons[i]), n.info) addStmt(w, n) - of nkFromStmt: - addModDep(w, getModuleName(n.sons[0])) + of nkFromStmt, nkImportExceptStmt: + addModDep(w, getModuleName(n.sons[0]), n.info) addStmt(w, n) of nkIncludeStmt: - for i in countup(0, sonsLen(n) - 1): addInclDep(w, getModuleName(n.sons[i])) + for i in countup(0, sonsLen(n) - 1): + addInclDep(w, getModuleName(n.sons[i]), n.info) of nkPragma: addStmt(w, n) else: diff --git a/lib/system.nim b/lib/system.nim index 356248e6c..28536b89b 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1831,9 +1831,6 @@ const NimVersion*: string = $NimMajor & "." & $NimMinor & "." & $NimPatch ## is the version of Nim as a string. -{.deprecated: [TEndian: Endianness, NimrodVersion: NimVersion, - NimrodMajor: NimMajor, NimrodMinor: NimMinor, NimrodPatch: NimPatch].} - # GC interface: when not defined(nimscript) and hasAlloc: diff --git a/tests/rodfiles/amethods.nim b/tests/rodfiles/amethods.nim index ecd36d491..29cf757f7 100644 --- a/tests/rodfiles/amethods.nim +++ b/tests/rodfiles/amethods.nim @@ -1,11 +1,11 @@ type - TBaseClass* = object of TObject + TBaseClass* = object of RootObj proc newBaseClass*: ref TBaseClass = new result -method echoType*(x: ref TBaseClass) = +method echoType*(x: ref TBaseClass) {.base.} = echo "base class" proc echoAlias*(x: ref TBaseClass) = diff --git a/tests/rodfiles/gtkex1.nim b/tests/rodfiles/gtkex1.nim index 156ba5322..50779cb9e 100644 --- a/tests/rodfiles/gtkex1.nim +++ b/tests/rodfiles/gtkex1.nim @@ -1,12 +1,12 @@ import cairo, glib2, gtk2 -proc destroy(widget: pWidget, data: pgpointer) {.cdecl.} = +proc destroy(widget: PWidget, data: Pgpointer) {.cdecl.} = main_quit() var - window: pWidget -nimrod_init() + window: PWidget +nim_init() window = window_new(WINDOW_TOPLEVEL) discard signal_connect(window, "destroy", SIGNAL_FUNC(gtkex1.destroy), nil) diff --git a/tests/rodfiles/gtkex2.nim b/tests/rodfiles/gtkex2.nim index 70926bd50..0949e4872 100644 --- a/tests/rodfiles/gtkex2.nim +++ b/tests/rodfiles/gtkex2.nim @@ -2,17 +2,17 @@ import glib2, gtk2 -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = +proc destroy(widget: PWidget, data: Pgpointer){.cdecl.} = main_quit() var window: PWidget button: PWidget -nimrod_init() +nim_init() window = window_new(WINDOW_TOPLEVEL) button = button_new("Click me") -set_border_width(PContainer(Window), 5) +set_border_width(PContainer(window), 5) add(PContainer(window), button) discard signal_connect(window, "destroy", SIGNAL_FUNC(gtkex2.destroy), nil) diff --git a/tests/rodfiles/int2bool.nim b/tests/rodfiles/int2bool.nim index 0f6fd14e6..bb0682844 100644 --- a/tests/rodfiles/int2bool.nim +++ b/tests/rodfiles/int2bool.nim @@ -2,7 +2,6 @@ {.overflowchecks: on.} converter uglyToBool*(x: int): bool = - {.Breakpoint.} result = x != 0 diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim index 671b5c8b7..8f0961566 100644 --- a/tests/testament/backend.nim +++ b/tests/testament/backend.nim @@ -59,6 +59,7 @@ var thisMachine: MachineId thisCommit: CommitId +{.experimental.} proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip proc getMachine*(db: DbConn): MachineId = diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index e534cc161..9b71cbf5f 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -24,7 +24,7 @@ proc delNimCache() = echo "[Warning] could not delete: ", nimcacheDir proc runRodFiles(r: var TResults, cat: Category, options: string) = - template test(filename: expr): stmt = + template test(filename: untyped) = testSpec r, makeTest(rodfilesDir / filename, options, cat, actionRun) delNimCache() @@ -46,18 +46,19 @@ proc runRodFiles(r: var TResults, cat: Category, options: string) = test "deada2" delNimCache() - # test method generation: - test "bmethods" - test "bmethods2" - delNimCache() + when false: + # test method generation: + test "bmethods" + test "bmethods2" + delNimCache() - # test generics: - test "tgeneric1" - test "tgeneric2" - delNimCache() + # test generics: + test "tgeneric1" + test "tgeneric2" + delNimCache() proc compileRodFiles(r: var TResults, cat: Category, options: string) = - template test(filename: expr): stmt = + template test(filename: untyped) = testSpec r, makeTest(rodfilesDir / filename, options, cat) delNimCache() @@ -114,20 +115,20 @@ proc dllTests(r: var TResults, cat: Category, options: string) = # ------------------------------ GC tests ------------------------------------- proc gcTests(r: var TResults, cat: Category, options: string) = - template testWithoutMs(filename: expr): stmt = + template testWithoutMs(filename: untyped) = testSpec r, makeTest("tests/gc" / filename, options, cat, actionRun) testSpec r, makeTest("tests/gc" / filename, options & " -d:release", cat, actionRun) testSpec r, makeTest("tests/gc" / filename, options & " -d:release -d:useRealtimeGC", cat, actionRun) - template testWithoutBoehm(filename: expr): stmt = + template testWithoutBoehm(filename: untyped) = testWithoutMs filename testSpec r, makeTest("tests/gc" / filename, options & " --gc:markAndSweep", cat, actionRun) testSpec r, makeTest("tests/gc" / filename, options & " -d:release --gc:markAndSweep", cat, actionRun) - template test(filename: expr): stmt = + template test(filename: untyped) = testWithoutBoehm filename when not defined(windows): # AR: cannot find any boehm.dll on the net, right now, so disabled @@ -173,7 +174,7 @@ proc longGCTests(r: var TResults, cat: Category, options: string) = # ------------------------- threading tests ----------------------------------- proc threadTests(r: var TResults, cat: Category, options: string) = - template test(filename: expr): stmt = + template test(filename: untyped) = testSpec r, makeTest("tests/threads" / filename, options, cat, actionRun) testSpec r, makeTest("tests/threads" / filename, options & " -d:release", cat, actionRun) @@ -209,7 +210,7 @@ proc debuggerTests(r: var TResults, cat: Category, options: string) = # ------------------------- JS tests ------------------------------------------ proc jsTests(r: var TResults, cat: Category, options: string) = - template test(filename: expr): stmt = + template test(filename: untyped) = testSpec r, makeTest(filename, options & " -d:nodejs", cat, actionRun, targetJS) testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat, @@ -369,9 +370,8 @@ proc `&?.`(a, b: string): string = proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") = case cat.string.normalize of "rodfiles": - discard # Disabled for now - #compileRodFiles(r, cat, options) - #runRodFiles(r, cat, options) + compileRodFiles(r, cat, options) + runRodFiles(r, cat, options) of "js": # XXX JS doesn't need to be special anymore jsTests(r, cat, options) |