diff options
author | Charles Blake <cblake@csail.mit.edu> | 2015-02-10 14:40:46 -0500 |
---|---|---|
committer | Charles Blake <cblake@csail.mit.edu> | 2015-02-10 14:40:46 -0500 |
commit | 7a64bb12323b92657526d01f08a3c3a2c7c82d1b (patch) | |
tree | d49a9c5db8c0f57a7a1605a067a0a7f957c48caa | |
parent | cc8dffb55932ec8193a2c592e579a7f0704c3b5f (diff) | |
parent | 0284e8d11c5f93f1ff6c44f83ca8e4ba73365c98 (diff) | |
download | Nim-7a64bb12323b92657526d01f08a3c3a2c7c82d1b.tar.gz |
Merge ../Nim into devel
-rw-r--r-- | compiler/astalgo.nim | 14 | ||||
-rw-r--r-- | compiler/installer.ini (renamed from compiler/nim.ini) | 0 | ||||
-rw-r--r-- | compiler/sem.nim | 6 | ||||
-rw-r--r-- | compiler/semdata.nim | 1 | ||||
-rw-r--r-- | compiler/semexprs.nim | 33 | ||||
-rw-r--r-- | compiler/semstmts.nim | 4 | ||||
-rw-r--r-- | compiler/semtypes.nim | 7 | ||||
-rw-r--r-- | compiler/sigmatch.nim | 2 | ||||
-rw-r--r-- | copying.txt | 2 | ||||
-rw-r--r-- | doc/niminst.txt | 2 | ||||
-rw-r--r-- | koch.nim | 14 | ||||
-rw-r--r-- | lib/system/assign.nim | 10 | ||||
-rw-r--r-- | lib/system/gc.nim | 38 | ||||
-rw-r--r-- | lib/system/gc_ms.nim | 10 | ||||
-rw-r--r-- | tests/gc/gcleak4.nim | 4 | ||||
-rw-r--r-- | tests/gc/growobjcrash.nim | 29 | ||||
-rw-r--r-- | tests/implicit/timplictderef.nim | 21 | ||||
-rw-r--r-- | tests/metatype/tautoproc.nim | 4 | ||||
-rw-r--r-- | tests/metatype/tcompositetypeclasses.nim | 2 | ||||
-rw-r--r-- | tests/metatype/tmatrix.nim (renamed from tests/matrix/tmatrix.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tmatrix1.nim (renamed from tests/matrix/tmatrix1.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tmatrix2.nim (renamed from tests/matrix/tmatrix2.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tmatrix3.nim (renamed from tests/static/tmatrix.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tstaticparammacro.nim (renamed from tests/static/tstaticparammacro.nim) | 1 | ||||
-rw-r--r-- | tests/metatype/ttypetraits.nim | 1 | ||||
-rw-r--r-- | tests/metatype/tymatrix.nim (renamed from tests/matrix/issue1013.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/typeclassinference.nim | 1 | ||||
-rw-r--r-- | tests/metatype/typedesc_as_value.nim | 11 | ||||
-rw-r--r-- | tests/modules/mnamspc1.nim (renamed from tests/namspc/mnamspc1.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mnamspc2.nim (renamed from tests/namspc/mnamspc2.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mopaque.nim (renamed from tests/module/mopaque.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mrecmod.nim (renamed from tests/module/mrecmod.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mrecmod2.nim (renamed from tests/module/mrecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/modules/tnamspc.nim (renamed from tests/namspc/tnamspc.nim) | 0 | ||||
-rw-r--r-- | tests/modules/topaque.nim (renamed from tests/module/topaque.nim) | 0 | ||||
-rw-r--r-- | tests/modules/trecinca.nim (renamed from tests/module/trecinca.nim) | 2 | ||||
-rw-r--r-- | tests/modules/trecincb.nim (renamed from tests/module/trecincb.nim) | 2 | ||||
-rw-r--r-- | tests/modules/trecmod.nim (renamed from tests/module/trecmod.nim) | 0 | ||||
-rw-r--r-- | tests/modules/trecmod2.nim (renamed from tests/module/trecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/trefobjsyntax.nim | 27 | ||||
-rw-r--r-- | tests/objvariant/treassign.nim | 27 | ||||
-rw-r--r-- | tests/testament/categories.nim | 3 | ||||
-rw-r--r-- | tests/types/temptyseqs.nim | 2 | ||||
-rw-r--r-- | todo.txt | 4 | ||||
-rw-r--r-- | tools/nimweb.nim | 2 | ||||
-rw-r--r-- | web/website.ini (renamed from web/nim.ini) | 33 |
46 files changed, 223 insertions, 96 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index f23e9a983..e9b82d74b 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -130,8 +130,8 @@ proc skipConvAndClosure*(n: PNode): PNode = proc sameValue*(a, b: PNode): bool = result = false case a.kind - of nkCharLit..nkInt64Lit: - if b.kind in {nkCharLit..nkInt64Lit}: result = a.intVal == b.intVal + of nkCharLit..nkUInt64Lit: + if b.kind in {nkCharLit..nkUInt64Lit}: result = a.intVal == b.intVal of nkFloatLit..nkFloat64Lit: if b.kind in {nkFloatLit..nkFloat64Lit}: result = a.floatVal == b.floatVal of nkStrLit..nkTripleStrLit: @@ -145,13 +145,13 @@ proc leValue*(a, b: PNode): bool = # a <= b? result = false case a.kind - of nkCharLit..nkInt64Lit: - if b.kind in {nkCharLit..nkInt64Lit}: result = a.intVal <= b.intVal - of nkFloatLit..nkFloat64Lit: + of nkCharLit..nkUInt32Lit: + if b.kind in {nkCharLit..nkUInt32Lit}: result = a.intVal <= b.intVal + of nkFloatLit..nkFloat64Lit: if b.kind in {nkFloatLit..nkFloat64Lit}: result = a.floatVal <= b.floatVal - of nkStrLit..nkTripleStrLit: + of nkStrLit..nkTripleStrLit: if b.kind in {nkStrLit..nkTripleStrLit}: result = a.strVal <= b.strVal - else: + else: # don't raise an internal error for 'nimrod check': #InternalError(a.info, "leValue") discard diff --git a/compiler/nim.ini b/compiler/installer.ini index dcf9aa52f..dcf9aa52f 100644 --- a/compiler/nim.ini +++ b/compiler/installer.ini diff --git a/compiler/sem.nim b/compiler/sem.nim index 214f471d6..2d69d4213 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -130,9 +130,11 @@ proc commonType*(x, y: PType): PType = elif a.kind == tyTuple and b.kind == tyTuple and a.len == b.len: var nt: PType for i in 0.. <a.len: - if isEmptyContainer(a.sons[i]) and not isEmptyContainer(b.sons[i]): + let aEmpty = isEmptyContainer(a.sons[i]) + let bEmpty = isEmptyContainer(b.sons[i]) + if aEmpty != bEmpty: if nt.isNil: nt = copyType(a, a.owner, false) - nt.sons[i] = b.sons[i] + nt.sons[i] = if aEmpty: b.sons[i] else: a.sons[i] if not nt.isNil: result = nt #elif b.sons[idx].kind == tyEmpty: return x elif a.kind == tyRange and b.kind == tyRange: diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 157761591..27d441000 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -221,6 +221,7 @@ proc makeTypeSymNode*(c: PContext, typ: PType, info: TLineInfo): PNode = proc makeTypeFromExpr*(c: PContext, n: PNode): PType = result = newTypeS(tyFromExpr, c) + assert n != nil result.n = n proc newTypeWithSons*(c: PContext, kind: TTypeKind, diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 40413e3eb..55d2656e0 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -448,25 +448,30 @@ proc changeType(n: PNode, newType: PType, check: bool) = let tup = newType.skipTypes({tyGenericInst}) if tup.kind != tyTuple: internalError(n.info, "changeType: no tuple type for constructor") - elif newType.n == nil: discard - elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr: - for i in countup(0, sonsLen(n) - 1): + elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr: + # named tuple? + for i in countup(0, sonsLen(n) - 1): var m = n.sons[i].sons[0] - if m.kind != nkSym: + if m.kind != nkSym: internalError(m.info, "changeType(): invalid tuple constr") return - var f = getSymFromList(newType.n, m.sym.name) - if f == nil: - internalError(m.info, "changeType(): invalid identifier") - return - changeType(n.sons[i].sons[1], f.typ, check) + if tup.n != nil: + var f = getSymFromList(newType.n, m.sym.name) + if f == nil: + internalError(m.info, "changeType(): invalid identifier") + return + changeType(n.sons[i].sons[1], f.typ, check) + else: + changeType(n.sons[i].sons[1], tup.sons[i], check) else: for i in countup(0, sonsLen(n) - 1): - var m = n.sons[i] - var a = newNodeIT(nkExprColonExpr, m.info, newType.sons[i]) - addSon(a, newSymNode(newType.n.sons[i].sym)) - addSon(a, m) - changeType(m, tup.sons[i], check) + changeType(n.sons[i], tup.sons[i], check) + when false: + var m = n.sons[i] + var a = newNodeIT(nkExprColonExpr, m.info, newType.sons[i]) + addSon(a, newSymNode(newType.n.sons[i].sym)) + addSon(a, m) + changeType(m, tup.sons[i], check) of nkCharLit..nkUInt64Lit: if check: let value = n.intVal diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 6e5b272de..07cae5d04 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -359,6 +359,10 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = var def: PNode if a.sons[length-1].kind != nkEmpty: def = semExprWithType(c, a.sons[length-1], {efAllowDestructor}) + if def.typ.kind == tyTypeDesc and c.p.owner.kind != skMacro: + # prevent the all too common 'var x = int' bug: + localError(def.info, "'typedesc' metatype is not valid here; typed '=' instead of ':'?") + def.typ = errorType(c) if typ != nil: if typ.isMetaType: def = inferWithMetatype(c, typ, def) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d052700b2..048154f12 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -781,9 +781,10 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, result.rawAddSon(paramType) for i in 0 .. paramType.sonsLen - 2: - let dummyType = if paramType.sons[i].kind == tyStatic: tyUnknown - else: tyAnything - result.rawAddSon newTypeS(dummyType, c) + if paramType.sons[i].kind == tyStatic: + result.rawAddSon makeTypeFromExpr(c, ast.emptyNode) # aka 'tyUnkown' + else: + result.rawAddSon newTypeS(tyAnything, c) if paramType.lastSon.kind == tyUserTypeClass: result.kind = tyUserTypeClassInst diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 2e37f3bf1..9a99d5200 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1056,7 +1056,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation = of tyFromExpr: # fix the expression, so it contains the already instantiated types - if f.n == nil: return isGeneric + if f.n == nil or f.n.kind == nkEmpty: return isGeneric let reevaluated = tryResolvingStaticExpr(c, f.n) case reevaluated.typ.kind of tyTypeDesc: diff --git a/copying.txt b/copying.txt index 908625e18..d89bace0b 100644 --- a/copying.txt +++ b/copying.txt @@ -1,7 +1,7 @@ ===================================================== Nim -- a Compiler for Nim. http://nim-lang.org/ -Copyright (C) 2006-2014 Andreas Rumpf. All rights reserved. +Copyright (C) 2006-2015 Andreas Rumpf. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/doc/niminst.txt b/doc/niminst.txt index d743c5187..ca05cc514 100644 --- a/doc/niminst.txt +++ b/doc/niminst.txt @@ -190,6 +190,6 @@ Real world example The installers for the Nim compiler itself are generated by niminst. Have a look at its configuration file: -.. include:: compiler/nim.ini +.. include:: compiler/installer.ini :literal: diff --git a/koch.nim b/koch.nim index 782a55e01..b0b4a79da 100644 --- a/koch.nim +++ b/koch.nim @@ -97,13 +97,13 @@ const compileNimInst = "-d:useLibzipSrc tools/niminst/niminst" proc csource(args: string) = - exec("$4 cc $1 -r $3 --var:version=$2 --var:mingw=none csource compiler/nim.ini $1" % + exec("$4 cc $1 -r $3 --var:version=$2 --var:mingw=none csource compiler/installer.ini $1" % [args, VersionAsString, compileNimInst, findNim()]) proc zip(args: string) = - exec("$3 cc -r $2 --var:version=$1 --var:mingw=none scripts compiler/nim.ini" % + exec("$3 cc -r $2 --var:version=$1 --var:mingw=none scripts compiler/installer.ini" % [VersionAsString, compileNimInst, findNim()]) - exec("$# --var:version=$# --var:mingw=none zip compiler/nim.ini" % + exec("$# --var:version=$# --var:mingw=none zip compiler/installer.ini" % ["tools/niminst/niminst".exe, VersionAsString]) proc buildTool(toolname, args: string) = @@ -121,20 +121,20 @@ proc nsis(args: string) = " nsis compiler/nim") % [VersionAsString, $(sizeof(pointer)*8)]) proc install(args: string) = - exec("$# cc -r $# --var:version=$# --var:mingw=none scripts compiler/nim.ini" % + exec("$# cc -r $# --var:version=$# --var:mingw=none scripts compiler/installer.ini" % [findNim(), compileNimInst, VersionAsString]) exec("sh ./install.sh $#" % args) proc web(args: string) = - exec("$# cc -r tools/nimweb.nim $# web/nim --putenv:nimversion=$#" % + exec("$# cc -r tools/nimweb.nim $# web/website.ini --putenv:nimversion=$#" % [findNim(), args, VersionAsString]) proc website(args: string) = - exec("$# cc -r tools/nimweb.nim $# --website web/nim --putenv:nimversion=$#" % + exec("$# cc -r tools/nimweb.nim $# --website web/website.ini --putenv:nimversion=$#" % [findNim(), args, VersionAsString]) proc pdf(args="") = - exec("$# cc -r tools/nimweb.nim $# --pdf web/nim --putenv:nimversion=$#" % + exec("$# cc -r tools/nimweb.nim $# --pdf web/website.ini --putenv:nimversion=$#" % [findNim(), args, VersionAsString]) # -------------- boot --------------------------------------------------------- diff --git a/lib/system/assign.nim b/lib/system/assign.nim index 429a92d34..78995954f 100644 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -27,7 +27,7 @@ proc genericAssignAux(dest, src: pointer, n: ptr TNimNode, var m = selectBranch(src, n) # reset if different branches are in use; note different branches also # imply that's not self-assignment (``x = x``)! - if m != dd and dd != nil: + if m != dd and dd != nil: genericResetAux(dest, dd) copyMem(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset), n.typ.size) @@ -205,9 +205,13 @@ proc genericReset(dest: pointer, mt: PNimType) = case mt.kind of tyString, tyRef, tySequence: unsureAsgnRef(cast[PPointer](dest), nil) - of tyObject, tyTuple: - # we don't need to reset m_type field for tyObject + of tyTuple: + genericResetAux(dest, mt.node) + of tyObject: genericResetAux(dest, mt.node) + # also reset the type field for tyObject, for correct branch switching! + var pint = cast[ptr PNimType](dest) + pint[] = nil of tyArray, tyArrayConstr: for i in 0..(mt.size div mt.base.size)-1: genericReset(cast[pointer](d +% i*% mt.base.size), mt.base) diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 844f28690..9459ee6b9 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -528,20 +528,9 @@ proc growObj(old: pointer, newsize: int, gch: var TGcHeap): pointer = zeroMem(cast[pointer](cast[ByteAddress](res)+% oldsize +% sizeof(TCell)), newsize-oldsize) sysAssert((cast[ByteAddress](res) and (MemAlign-1)) == 0, "growObj: 3") - sysAssert(res.refcount shr rcShift <=% 1, "growObj: 4") - #if res.refcount <% rcIncrement: - # add(gch.zct, res) - #else: # XXX: what to do here? - # decRef(ol) - if (ol.refcount and ZctFlag) != 0: - var j = gch.zct.len-1 - var d = gch.zct.d - while j >= 0: - if d[j] == ol: - d[j] = res - break - dec(j) - if canbeCycleRoot(ol): excl(gch.cycleRoots, ol) + # This can be wrong for intermediate temps that are nevertheless on the + # heap because of lambda lifting: + #gcAssert(res.refcount shr rcShift <=% 1, "growObj: 4") when logGC: writeCell("growObj old cell", ol) writeCell("growObj new cell", res) @@ -549,7 +538,26 @@ proc growObj(old: pointer, newsize: int, gch: var TGcHeap): pointer = gcTrace(res, csAllocated) when reallyDealloc: sysAssert(allocInv(gch.region), "growObj before dealloc") - rawDealloc(gch.region, ol) + if ol.refcount shr rcShift <=% 1: + # free immediately to save space: + if (ol.refcount and ZctFlag) != 0: + var j = gch.zct.len-1 + var d = gch.zct.d + while j >= 0: + if d[j] == ol: + d[j] = res + break + dec(j) + if canbeCycleRoot(ol): excl(gch.cycleRoots, ol) + rawDealloc(gch.region, ol) + else: + # we split the old refcount in 2 parts. XXX This is still not entirely + # correct if the pointer that receives growObj's result is on the stack. + # A better fix would be to emit the location specific write barrier for + # 'growObj', but this is lost of more work and who knows what new problems + # this would create. + res.refcount = rcIncrement + decRef(ol) else: sysAssert(ol.typ != nil, "growObj: 5") zeroMem(ol, sizeof(TCell)) diff --git a/lib/system/gc_ms.nim b/lib/system/gc_ms.nim index 9c3ee8ce2..014b7c278 100644 --- a/lib/system/gc_ms.nim +++ b/lib/system/gc_ms.nim @@ -297,10 +297,12 @@ proc growObj(old: pointer, newsize: int, gch: var TGcHeap): pointer = zeroMem(cast[pointer](cast[ByteAddress](res)+% oldsize +% sizeof(TCell)), newsize-oldsize) sysAssert((cast[ByteAddress](res) and (MemAlign-1)) == 0, "growObj: 3") - when withBitvectors: excl(gch.allocated, ol) - when reallyDealloc: rawDealloc(gch.region, ol) - else: - zeroMem(ol, sizeof(TCell)) + when false: + # this is wrong since seqs can be shared via 'shallow': + when withBitvectors: excl(gch.allocated, ol) + when reallyDealloc: rawDealloc(gch.region, ol) + else: + zeroMem(ol, sizeof(TCell)) when withBitvectors: incl(gch.allocated, res) when useCellIds: inc gch.idGenerator diff --git a/tests/gc/gcleak4.nim b/tests/gc/gcleak4.nim index 6f2b8a1fe..54e74ac7b 100644 --- a/tests/gc/gcleak4.nim +++ b/tests/gc/gcleak4.nim @@ -38,12 +38,14 @@ proc newPlus(a, b: ref TExpr): ref TPlusExpr = result.b = b result.op2 = $getOccupiedMem() +const Limit = when compileOption("gc", "markAndSweep"): 5*1024*1024 else: 500_000 + for i in 0..100_000: var s: array[0..11, ref TExpr] for j in 0..high(s): s[j] = newPlus(newPlus(newLit(j), newLit(2)), newLit(4)) if eval(s[j]) != j+6: quit "error: wrong result" - if getOccupiedMem() > 500_000: quit("still a leak!") + if getOccupiedMem() > Limit: quit("still a leak!") echo "no leak: ", getOccupiedMem() diff --git a/tests/gc/growobjcrash.nim b/tests/gc/growobjcrash.nim new file mode 100644 index 000000000..00620fed3 --- /dev/null +++ b/tests/gc/growobjcrash.nim @@ -0,0 +1,29 @@ +discard """ + output: "works" +""" + +import cgi, strtabs + +proc handleRequest(query: string): StringTableRef = + iterator foo(): StringTableRef {.closure.} = + var params = {:}.newStringTable() + for key, val in cgi.decodeData(query): + params[key] = val + yield params + + let x = foo + result = x() + +const Limit = when compileOption("gc", "markAndSweep"): 5*1024*1024 else: 500_000 + +proc main = + var counter = 0 + for i in 0 .. 100_000: + for k, v in handleRequest("nick=Elina2&type=activate"): + inc counter + if counter mod 100 == 0: + if getOccupiedMem() > Limit: + quit "but now a leak" + +main() +echo "works" diff --git a/tests/implicit/timplictderef.nim b/tests/implicit/timplictderef.nim index 99b0b645b..fcb647217 100644 --- a/tests/implicit/timplictderef.nim +++ b/tests/implicit/timplictderef.nim @@ -1,9 +1,10 @@ discard """ - output: "2" + output: '''2 +88''' """ type - TValue* {.pure, final.} = object of TObject + TValue* {.pure, final.} = object of RootObj a: int PValue = ref TValue PPValue = ptr PValue @@ -16,3 +17,19 @@ var sp: PPValue = addr x sp.a = 2 if sp.a == 2: echo 2 # with sp[].a the error is gone +# Test the new auto-deref a little + +{.experimental.} + +proc p(x: var int; y: int) = x += y + +block: + var x: ref int + new(x) + + x.p(44) + + var indirect = p + x.indirect(44) + + echo x[] diff --git a/tests/metatype/tautoproc.nim b/tests/metatype/tautoproc.nim index 9e8ff0bcb..562f508fc 100644 --- a/tests/metatype/tautoproc.nim +++ b/tests/metatype/tautoproc.nim @@ -1,3 +1,7 @@ +discard """ + errormsg: "expression 'generate(builder)' has no type (or is ambiguous)" +""" + # bug #898 proc measureTime(e: auto) = diff --git a/tests/metatype/tcompositetypeclasses.nim b/tests/metatype/tcompositetypeclasses.nim index 5ae93795f..1cb86e4d7 100644 --- a/tests/metatype/tcompositetypeclasses.nim +++ b/tests/metatype/tcompositetypeclasses.nim @@ -30,7 +30,7 @@ accept bar(vbar) accept baz(vbar) accept baz(vbaz) -reject baz(vnotbaz) +#reject baz(vnotbaz) # XXX this really shouldn't compile reject bar(vfoo) # https://github.com/Araq/Nim/issues/517 diff --git a/tests/matrix/tmatrix.nim b/tests/metatype/tmatrix.nim index 90dfde959..90dfde959 100644 --- a/tests/matrix/tmatrix.nim +++ b/tests/metatype/tmatrix.nim diff --git a/tests/matrix/tmatrix1.nim b/tests/metatype/tmatrix1.nim index 0adf30b57..0adf30b57 100644 --- a/tests/matrix/tmatrix1.nim +++ b/tests/metatype/tmatrix1.nim diff --git a/tests/matrix/tmatrix2.nim b/tests/metatype/tmatrix2.nim index 82990f1a5..82990f1a5 100644 --- a/tests/matrix/tmatrix2.nim +++ b/tests/metatype/tmatrix2.nim diff --git a/tests/static/tmatrix.nim b/tests/metatype/tmatrix3.nim index a143e2bc9..a143e2bc9 100644 --- a/tests/static/tmatrix.nim +++ b/tests/metatype/tmatrix3.nim diff --git a/tests/static/tstaticparammacro.nim b/tests/metatype/tstaticparammacro.nim index ebd6caa47..e577efc56 100644 --- a/tests/static/tstaticparammacro.nim +++ b/tests/metatype/tstaticparammacro.nim @@ -14,6 +14,7 @@ AST b 20Test 20 ''' + disabled: true """ import macros diff --git a/tests/metatype/ttypetraits.nim b/tests/metatype/ttypetraits.nim index 4344855eb..4c3ad9e0b 100644 --- a/tests/metatype/ttypetraits.nim +++ b/tests/metatype/ttypetraits.nim @@ -1,6 +1,7 @@ discard """ msg: "int\nstring\nTBar[int]" output: "int\nstring\nTBar[int]\nint\nrange 0..2(int)\nstring" + disabled: true """ import typetraits diff --git a/tests/matrix/issue1013.nim b/tests/metatype/tymatrix.nim index 7d3d52f85..7d3d52f85 100644 --- a/tests/matrix/issue1013.nim +++ b/tests/metatype/tymatrix.nim diff --git a/tests/metatype/typeclassinference.nim b/tests/metatype/typeclassinference.nim index 2ac037ac5..fd2d307a9 100644 --- a/tests/metatype/typeclassinference.nim +++ b/tests/metatype/typeclassinference.nim @@ -1,6 +1,7 @@ discard """ errormsg: "type mismatch: got (string) but expected 'ptr'" line: 20 + disabled: true """ import typetraits diff --git a/tests/metatype/typedesc_as_value.nim b/tests/metatype/typedesc_as_value.nim new file mode 100644 index 000000000..f6e526987 --- /dev/null +++ b/tests/metatype/typedesc_as_value.nim @@ -0,0 +1,11 @@ +discard """ + errormsg: "'typedesc' metatype is not valid here; typed '=' instead of ':'?" +""" + + +var x = int + +echo x + + + diff --git a/tests/namspc/mnamspc1.nim b/tests/modules/mnamspc1.nim index da13c5f24..da13c5f24 100644 --- a/tests/namspc/mnamspc1.nim +++ b/tests/modules/mnamspc1.nim diff --git a/tests/namspc/mnamspc2.nim b/tests/modules/mnamspc2.nim index 84ef8533e..84ef8533e 100644 --- a/tests/namspc/mnamspc2.nim +++ b/tests/modules/mnamspc2.nim diff --git a/tests/module/mopaque.nim b/tests/modules/mopaque.nim index 7eee4bd96..7eee4bd96 100644 --- a/tests/module/mopaque.nim +++ b/tests/modules/mopaque.nim diff --git a/tests/module/mrecmod.nim b/tests/modules/mrecmod.nim index fab9654d5..fab9654d5 100644 --- a/tests/module/mrecmod.nim +++ b/tests/modules/mrecmod.nim diff --git a/tests/module/mrecmod2.nim b/tests/modules/mrecmod2.nim index 9557ce729..9557ce729 100644 --- a/tests/module/mrecmod2.nim +++ b/tests/modules/mrecmod2.nim diff --git a/tests/namspc/tnamspc.nim b/tests/modules/tnamspc.nim index 1e2049cec..1e2049cec 100644 --- a/tests/namspc/tnamspc.nim +++ b/tests/modules/tnamspc.nim diff --git a/tests/module/topaque.nim b/tests/modules/topaque.nim index f0587c959..f0587c959 100644 --- a/tests/module/topaque.nim +++ b/tests/modules/topaque.nim diff --git a/tests/module/trecinca.nim b/tests/modules/trecinca.nim index 62d37783c..bedea8d7e 100644 --- a/tests/module/trecinca.nim +++ b/tests/modules/trecinca.nim @@ -1,7 +1,7 @@ discard """ file: "tests/reject/trecincb.nim" line: 9 - errormsg: "recursive dependency: 'tests/module/trecincb.nim'" + errormsg: "recursive dependency: 'trecincb.nim'" """ # Test recursive includes diff --git a/tests/module/trecincb.nim b/tests/modules/trecincb.nim index a2934052f..eb0f72db0 100644 --- a/tests/module/trecincb.nim +++ b/tests/modules/trecincb.nim @@ -1,7 +1,7 @@ discard """ file: "trecincb.nim" line: 9 - errormsg: "recursive dependency: 'tests/module/trecincb.nim'" + errormsg: "recursive dependency: 'trecincb.nim'" """ # Test recursive includes diff --git a/tests/module/trecmod.nim b/tests/modules/trecmod.nim index 9d39d3ff7..9d39d3ff7 100644 --- a/tests/module/trecmod.nim +++ b/tests/modules/trecmod.nim diff --git a/tests/module/trecmod2.nim b/tests/modules/trecmod2.nim index 85fe2215f..85fe2215f 100644 --- a/tests/module/trecmod2.nim +++ b/tests/modules/trecmod2.nim diff --git a/tests/objects/trefobjsyntax.nim b/tests/objects/trefobjsyntax.nim new file mode 100644 index 000000000..9b48de718 --- /dev/null +++ b/tests/objects/trefobjsyntax.nim @@ -0,0 +1,27 @@ +discard """ + output: '''wohoo +baz''' +""" + +# Test to ensure the popular 'ref T' syntax works everywhere + +type + Foo = object + a, b: int + s: string + + FooBar = object of RootObj + n, m: string + Baz = object of FooBar + +proc invoke(a: ref Baz) = + echo "baz" + +# check object construction: +let x = (ref Foo)(a: 0, b: 45, s: "wohoo") +echo x.s + +var y: ref FooBar = (ref Baz)(n: "n", m: "m") + +invoke((ref Baz)(y)) + diff --git a/tests/objvariant/treassign.nim b/tests/objvariant/treassign.nim new file mode 100644 index 000000000..2938b30a3 --- /dev/null +++ b/tests/objvariant/treassign.nim @@ -0,0 +1,27 @@ +discard """ + output: "SUCCESS" +""" + +type + BasicNumber = object of RootObj + value: float32 + RefChild* = ref object + curr*: TokenObject + Token* {.pure.} = enum + foo, + bar, + TokenObject = object + case kind*: Token + of Token.foo: + foo*: string + of Token.bar: + bar*: BasicNumber + + +var t = RefChild() + +t.curr = TokenObject(kind: Token.bar, bar: BasicNumber(value: 12.34)) + +t.curr = TokenObject(kind: Token.foo, foo: "foo") + +echo "SUCCESS" diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 54e962693..ed4d27cab 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -120,7 +120,8 @@ proc gcTests(r: var TResults, cat: Category, options: string) = " --gc:markAndSweep", cat, actionRun) testSpec r, makeTest("tests/gc" / filename, options & " -d:release --gc:markAndSweep", cat, actionRun) - + + test "growobjcrash" test "gcbench" test "gcleak" test "gcleak2" diff --git a/tests/types/temptyseqs.nim b/tests/types/temptyseqs.nim index f8d22bdb8..2b07ba679 100644 --- a/tests/types/temptyseqs.nim +++ b/tests/types/temptyseqs.nim @@ -5,7 +5,7 @@ discard """ # bug #1708 let foo = { "1" : (bar: @["1"]), - "2" : (baz: @[]) + "2" : (bar: @[]) } # bug #871 diff --git a/todo.txt b/todo.txt index 252699bf1..706954f65 100644 --- a/todo.txt +++ b/todo.txt @@ -4,8 +4,6 @@ version 0.10.4 - make 'nil' work for 'add' and 'len' - improve GC-unsafety warnings - get rid of 'mget'; aka priority of 'var' needs to be 'var{lvalue}' -- improve documentation (theindex!) -- fix the getUniqueType() bug version 1.0 @@ -67,7 +65,6 @@ version 0.9.x - memory manager: add a measure of fragmentation - implement 'bits' pragmas - we need a magic thisModule symbol -- ensure (ref T)(a, b) works as a type conversion and type constructor - optimize 'genericReset'; 'newException' leads to code bloat - The 'do' notation might be trimmed so that its only purpose is to pass multiple multi line constructs to a macro. @@ -96,4 +93,3 @@ CGEN ==== - codegen should use "NIM_CAST" macro and respect aliasing rules for GCC - ``restrict`` pragma + backend support -- 'const' objects including case objects diff --git a/tools/nimweb.nim b/tools/nimweb.nim index e74daf98f..8213cf418 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -319,7 +319,7 @@ proc buildAddDoc(c: var TConfigData, destPath: string) = # build additional documentation (without the index): var commands = newSeq[string](c.webdoc.len) for i, doc in pairs(c.webdoc): - commands[i] = "nim doc $# --docSeeSrcUrl:$#/$#/$# -o:$# $#" % + commands[i] = "nim doc2 $# --docSeeSrcUrl:$#/$#/$# -o:$# $#" % [c.nimArgs, c.gitRepo, c.gitCommit, doc.pathPart, destPath / changeFileExt(splitFile(doc).name, "html"), doc] mexec(commands, c.numProcessors) diff --git a/web/nim.ini b/web/website.ini index 0190416b2..c0a648c56 100644 --- a/web/nim.ini +++ b/web/website.ini @@ -27,19 +27,6 @@ news: news [Ticker] file: ticker.txt -[Quotations] -# Page: quote - Person -# Bad things will happen if you use multiple dashes here. -index: """Is it so bad, then, to be misunderstood? Pythagoras was misunderstood, -and Socrates, and Jesus, and Luther, and Copernicus, and Galileo, and Newton, -and every pure and wise spirit that ever took flesh. To be great is to be -misunderstood. - Ralph Waldo Emerson""" -documentation: """Incorrect documentation is often worse than no documentation. -- Bertrand Meyer""" -download: """There are two major products that come out of Berkeley: LSD and -UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson.""" -learn: """Repetition renders the ridiculous reasonable. - Norman Wildberger""" - [Documentation] doc: "endb;intern;apis;lib;manual.txt;tut1;tut2;nimc;overview;filters" doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt" @@ -61,7 +48,7 @@ srcdoc2: "pure/httpserver;pure/httpclient;pure/smtp;impure/ssl;pure/fsmonitor" srcdoc2: "pure/ropes;pure/unidecode/unidecode;pure/xmldom;pure/xmldomparser" srcdoc2: "pure/xmlparser;pure/htmlparser;pure/xmltree;pure/colors;pure/mimetypes" srcdoc2: "pure/json;pure/base64;pure/scgi;pure/redis;impure/graphics" -srcdoc2: "impure/rdstdin;wrappers/sphinx" +srcdoc2: "impure/rdstdin" srcdoc2: "pure/collections/tables;pure/collections/sets;pure/collections/lists" srcdoc2: "pure/collections/intsets;pure/collections/queues;pure/encodings" srcdoc2: "pure/events;pure/collections/sequtils;pure/cookies" @@ -71,19 +58,15 @@ srcdoc2: "pure/nimprof;pure/unittest;packages/docutils/highlite" srcdoc2: "packages/docutils/rst;packages/docutils/rstast" srcdoc2: "packages/docutils/rstgen;pure/logging;pure/asyncdispatch;pure/asyncnet" srcdoc2: "pure/rawsockets;pure/asynchttpserver;pure/net;pure/selectors;pure/future" -srcdoc2: "wrappers/expat;wrappers/readline/history" -srcdoc2: "wrappers/libsvm.nim;wrappers/libuv" -srcdoc2: "wrappers/zip/zlib;wrappers/zip/libzip" -srcdoc2: "pure/md5;wrappers/mysql;wrappers/iup" -srcdoc2: "posix/posix;wrappers/odbcsql" -srcdoc2: "wrappers/tre;wrappers/openssl;wrappers/pcre" -srcdoc2: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc" -srcdoc2: "wrappers/readline/readline;wrappers/readline/rltypedefs" -srcdoc2: "wrappers/joyent_http_parser" +srcdoc2: "pure/md5" +srcdoc2: "posix/posix" srcdoc2: "pure/fenv" -webdoc: "pure/md5;wrappers/mysql;wrappers/iup" -webdoc: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc" +; Note: everything under 'webdoc' doesn't get listed in the index, so wrappers +; should live here + +webdoc: "wrappers/mysql;wrappers/iup;wrappers/sphinx" +webdoc: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc;wrappers/odbcsql" webdoc: "wrappers/expat;wrappers/pcre" webdoc: "wrappers/tre;wrappers/openssl" webdoc: "wrappers/libuv;wrappers/joyent_http_parser" |