diff options
author | Araq <rumpf_a@web.de> | 2016-08-27 13:38:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-08-27 13:38:39 +0200 |
commit | 68e30d7d52d84578fbe0f6f1c2041b150251e800 (patch) | |
tree | 6dfb38147f00b940543a96b97c093053809ec7af | |
parent | 7630cd076bbdb9c3b1b851ffc6dc6a8ada07f4a6 (diff) | |
download | Nim-68e30d7d52d84578fbe0f6f1c2041b150251e800.tar.gz |
tester cleanup; enable some rod tests
-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/rodwrite.nim | 15 | ||||
-rw-r--r-- | tests/testament/backend.nim | 1 | ||||
-rw-r--r-- | tests/testament/categories.nim | 31 |
6 files changed, 31 insertions, 25 deletions
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 55e337969..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* = "1218" # modify this if the rod-format changes! + RodFileVersion* = "1221" # modify this if the rod-format changes! diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim index 557b1dabf..addbdade6 100644 --- a/compiler/rodwrite.nim +++ b/compiler/rodwrite.nim @@ -74,7 +74,7 @@ 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; info: TLineInfo) = @@ -100,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, @@ -119,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) @@ -224,8 +228,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) = if t.lockLevel.ord != UnspecifiedLockLevel.ord: add(result, '\14') encodeVInt(t.lockLevel.int16, result) - - if t.destructor != nil: + if t.destructor != nil and t.destructor.id != 0: add(result, '\15') encodeVInt(t.destructor.id, result) pushSym(w, t.destructor) @@ -293,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) @@ -607,7 +610,7 @@ proc process(c: PPassContext, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): addModDep(w, getModuleName(n.sons[i]), n.info) addStmt(w, n) - of nkFromStmt: + of nkFromStmt, nkImportExceptStmt: addModDep(w, getModuleName(n.sons[0]), n.info) addStmt(w, n) of nkIncludeStmt: 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 eebf18f54..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, |