Merge branch 'devel'
This commit is contained in:
commit
ac1fbf1469
24 changed files with 339 additions and 181 deletions
|
|
@ -964,8 +964,11 @@ proc genEcho(p: BProc, n: PNode) =
|
||||||
var args: Rope = nil
|
var args: Rope = nil
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
for i in countup(0, n.len-1):
|
for i in countup(0, n.len-1):
|
||||||
initLocExpr(p, n.sons[i], a)
|
if n.sons[i].skipConv.kind == nkNilLit:
|
||||||
addf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)])
|
add(args, ", \"nil\"")
|
||||||
|
else:
|
||||||
|
initLocExpr(p, n.sons[i], a)
|
||||||
|
addf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)])
|
||||||
linefmt(p, cpsStmts, "printf($1$2);$n",
|
linefmt(p, cpsStmts, "printf($1$2);$n",
|
||||||
makeCString(repeat("%s", n.len) & tnl), args)
|
makeCString(repeat("%s", n.len) & tnl), args)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ Start: "doc/overview.html"
|
||||||
|
|
||||||
[Other]
|
[Other]
|
||||||
Files: "readme.txt;install.txt;contributors.txt;copying.txt"
|
Files: "readme.txt;install.txt;contributors.txt;copying.txt"
|
||||||
Files: "configure;makefile"
|
Files: "makefile"
|
||||||
Files: "*.ini"
|
Files: "*.ini"
|
||||||
Files: "koch.nim"
|
Files: "koch.nim"
|
||||||
|
|
||||||
|
|
@ -70,6 +70,10 @@ Files: "doc/*.nim"
|
||||||
Files: "doc/*.cfg"
|
Files: "doc/*.cfg"
|
||||||
Files: "compiler/nimfix/*.nim"
|
Files: "compiler/nimfix/*.nim"
|
||||||
Files: "compiler/nimfix/*.cfg"
|
Files: "compiler/nimfix/*.cfg"
|
||||||
|
Files: "compiler/nimsuggest/*.nim"
|
||||||
|
Files: "compiler/nimsuggest/*.cfg"
|
||||||
|
Files: "compiler/plugins/locals/*.nim"
|
||||||
|
Files: "compiler/plugins/active.nim"
|
||||||
Files: "tools/*.nim"
|
Files: "tools/*.nim"
|
||||||
Files: "tools/*.cfg"
|
Files: "tools/*.cfg"
|
||||||
Files: "tools/*.tmpl"
|
Files: "tools/*.tmpl"
|
||||||
|
|
@ -97,13 +101,8 @@ Files: "lib/pure/concurrency/*.cfg"
|
||||||
Files: "lib/impure/*.nim"
|
Files: "lib/impure/*.nim"
|
||||||
Files: "lib/wrappers/*.nim"
|
Files: "lib/wrappers/*.nim"
|
||||||
|
|
||||||
Files: "lib/wrappers/cairo/*.nim"
|
|
||||||
Files: "lib/wrappers/gtk/*.nim"
|
|
||||||
Files: "lib/wrappers/lua/*.nim"
|
|
||||||
Files: "lib/wrappers/opengl/*.nim"
|
|
||||||
Files: "lib/wrappers/readline/*.nim"
|
Files: "lib/wrappers/readline/*.nim"
|
||||||
Files: "lib/wrappers/sdl/*.nim"
|
Files: "lib/wrappers/sdl/*.nim"
|
||||||
Files: "lib/wrappers/x11/*.nim"
|
|
||||||
Files: "lib/wrappers/zip/*.nim"
|
Files: "lib/wrappers/zip/*.nim"
|
||||||
Files: "lib/wrappers/zip/libzip_all.c"
|
Files: "lib/wrappers/zip/libzip_all.c"
|
||||||
|
|
||||||
|
|
@ -115,8 +114,6 @@ Files: "lib/packages/docutils/*.nim"
|
||||||
|
|
||||||
[Other]
|
[Other]
|
||||||
Files: "examples/*.nim"
|
Files: "examples/*.nim"
|
||||||
Files: "examples/gtk/*.nim"
|
|
||||||
Files: "examples/0mq/*.nim"
|
|
||||||
Files: "examples/c++iface/*.nim"
|
Files: "examples/c++iface/*.nim"
|
||||||
Files: "examples/objciface/*.nim"
|
Files: "examples/objciface/*.nim"
|
||||||
Files: "examples/cross_calculator/"
|
Files: "examples/cross_calculator/"
|
||||||
|
|
@ -239,7 +236,7 @@ BinPath: r"bin;dist\mingw\bin;dist"
|
||||||
; Section | dir | zipFile | size hint (in KB) | url | exe start menu entry
|
; Section | dir | zipFile | size hint (in KB) | url | exe start menu entry
|
||||||
Download: r"Documentation|doc|docs.zip|13824|http://nim-lang.org/download/docs-${version}.zip|overview.html"
|
Download: r"Documentation|doc|docs.zip|13824|http://nim-lang.org/download/docs-${version}.zip|overview.html"
|
||||||
Download: r"C Compiler (MingW)|dist|mingw.zip|82944|http://nim-lang.org/download/${mingw}.zip"
|
Download: r"C Compiler (MingW)|dist|mingw.zip|82944|http://nim-lang.org/download/${mingw}.zip"
|
||||||
Download: r"Aporia IDE|dist|aporia.zip|97997|http://nim-lang.org/download/aporia-0.3.0.zip|aporia\bin\aporia.exe"
|
Download: r"Aporia IDE|dist|aporia.zip|97997|http://nim-lang.org/download/aporia-0.3.0.zip|aporia-0.3.0\bin\aporia.exe"
|
||||||
; for now only NSIS supports optional downloads
|
; for now only NSIS supports optional downloads
|
||||||
|
|
||||||
[UnixBin]
|
[UnixBin]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nim Compiler
|
# The Nim Compiler
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
# (c) Copyright 2015 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,18 @@ proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
result.sons[i] = fitNode(c, typ, result.sons[i])
|
result.sons[i] = fitNode(c, typ, result.sons[i])
|
||||||
result.typ.sons[0] = makeRangeType(c, 0, sonsLen(result) - 1, n.info)
|
result.typ.sons[0] = makeRangeType(c, 0, sonsLen(result) - 1, n.info)
|
||||||
|
|
||||||
template fixAbstractType(c: PContext, n: PNode) =
|
proc fixAbstractType(c: PContext, n: PNode) =
|
||||||
|
for i in 1 .. < n.len:
|
||||||
|
let it = n.sons[i]
|
||||||
|
# do not get rid of nkHiddenSubConv for OpenArrays, the codegen needs it:
|
||||||
|
if it.kind == nkHiddenSubConv and
|
||||||
|
skipTypes(it.typ, abstractVar).kind notin {tyOpenArray, tyVarargs}:
|
||||||
|
if skipTypes(it.sons[1].typ, abstractVar).kind in
|
||||||
|
{tyNil, tyArrayConstr, tyTuple, tySet}:
|
||||||
|
var s = skipTypes(it.typ, abstractVar)
|
||||||
|
if s.kind != tyExpr:
|
||||||
|
changeType(it.sons[1], s, check=true)
|
||||||
|
n.sons[i] = it.sons[1]
|
||||||
when false:
|
when false:
|
||||||
# XXX finally rewrite that crap!
|
# XXX finally rewrite that crap!
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
|
|
@ -2042,7 +2053,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||||
of nkEmpty, nkNone, nkCommentStmt:
|
of nkEmpty, nkNone, nkCommentStmt:
|
||||||
discard
|
discard
|
||||||
of nkNilLit:
|
of nkNilLit:
|
||||||
result.typ = getSysType(tyNil)
|
if result.typ == nil: result.typ = getSysType(tyNil)
|
||||||
of nkIntLit:
|
of nkIntLit:
|
||||||
if result.typ == nil: setIntLitType(result)
|
if result.typ == nil: setIntLitType(result)
|
||||||
of nkInt8Lit:
|
of nkInt8Lit:
|
||||||
|
|
|
||||||
|
|
@ -286,10 +286,13 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode =
|
||||||
of mNot: result = newIntNodeT(1 - getInt(a), n)
|
of mNot: result = newIntNodeT(1 - getInt(a), n)
|
||||||
of mCard: result = newIntNodeT(nimsets.cardSet(a), n)
|
of mCard: result = newIntNodeT(nimsets.cardSet(a), n)
|
||||||
of mBitnotI, mBitnotI64: result = newIntNodeT(not getInt(a), n)
|
of mBitnotI, mBitnotI64: result = newIntNodeT(not getInt(a), n)
|
||||||
of mLengthStr, mXLenStr: result = newIntNodeT(len(getStr(a)), n)
|
of mLengthStr, mXLenStr:
|
||||||
|
if a.kind == nkNilLit: result = newIntNodeT(0, n)
|
||||||
|
else: result = newIntNodeT(len(getStr(a)), n)
|
||||||
of mLengthArray: result = newIntNodeT(lengthOrd(a.typ), n)
|
of mLengthArray: result = newIntNodeT(lengthOrd(a.typ), n)
|
||||||
of mLengthSeq, mLengthOpenArray, mXLenSeq:
|
of mLengthSeq, mLengthOpenArray, mXLenSeq:
|
||||||
result = newIntNodeT(sonsLen(a), n) # BUGFIX
|
if a.kind == nkNilLit: result = newIntNodeT(0, n)
|
||||||
|
else: result = newIntNodeT(sonsLen(a), n) # BUGFIX
|
||||||
of mUnaryPlusI, mUnaryPlusF64: result = a # throw `+` away
|
of mUnaryPlusI, mUnaryPlusF64: result = a # throw `+` away
|
||||||
of mToFloat, mToBiggestFloat:
|
of mToFloat, mToBiggestFloat:
|
||||||
result = newFloatNodeT(toFloat(int(getInt(a))), n)
|
result = newFloatNodeT(toFloat(int(getInt(a))), n)
|
||||||
|
|
@ -545,7 +548,7 @@ proc foldConv*(n, a: PNode; check = false): PNode =
|
||||||
discard
|
discard
|
||||||
else:
|
else:
|
||||||
result = a
|
result = a
|
||||||
result.typ = takeType(n.typ, a.typ)
|
result.typ = n.typ
|
||||||
|
|
||||||
proc getArrayConstr(m: PSym, n: PNode): PNode =
|
proc getArrayConstr(m: PSym, n: PNode): PNode =
|
||||||
if n.kind == nkBracket:
|
if n.kind == nkBracket:
|
||||||
|
|
@ -652,7 +655,7 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
|
||||||
result = copyNode(n)
|
result = copyNode(n)
|
||||||
of nkIfExpr:
|
of nkIfExpr:
|
||||||
result = getConstIfExpr(m, n)
|
result = getConstIfExpr(m, n)
|
||||||
of nkCall, nkCommand, nkCallStrLit, nkPrefix, nkInfix:
|
of nkCallKinds:
|
||||||
if n.sons[0].kind != nkSym: return
|
if n.sons[0].kind != nkSym: return
|
||||||
var s = n.sons[0].sym
|
var s = n.sons[0].sym
|
||||||
if s.kind != skProc: return
|
if s.kind != skProc: return
|
||||||
|
|
|
||||||
|
|
@ -716,8 +716,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||||
add(result, PTransNode(newSymNode(labl)))
|
add(result, PTransNode(newSymNode(labl)))
|
||||||
of nkBreakStmt: result = transformBreak(c, n)
|
of nkBreakStmt: result = transformBreak(c, n)
|
||||||
of nkWhileStmt: result = transformWhile(c, n)
|
of nkWhileStmt: result = transformWhile(c, n)
|
||||||
of nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix,
|
of nkCallKinds:
|
||||||
nkCallStrLit:
|
|
||||||
result = transformCall(c, n)
|
result = transformCall(c, n)
|
||||||
of nkAddr, nkHiddenAddr:
|
of nkAddr, nkHiddenAddr:
|
||||||
result = transformAddrDeref(c, n, nkDerefExpr, nkHiddenDeref)
|
result = transformAddrDeref(c, n, nkDerefExpr, nkHiddenDeref)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ path="$lib/pure/unidecode"
|
||||||
|
|
||||||
# Configuration for the GNU C/C++ compiler:
|
# Configuration for the GNU C/C++ compiler:
|
||||||
@if windows:
|
@if windows:
|
||||||
#gcc.path = r"$nimrod\dist\mingw\bin"
|
#gcc.path = r"$nim\dist\mingw\bin"
|
||||||
@if gcc:
|
@if gcc:
|
||||||
tlsEmulation:on
|
tlsEmulation:on
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -1451,7 +1451,7 @@ operators perform implicit dereferencing operations for reference types:
|
||||||
type
|
type
|
||||||
Node = ref NodeObj
|
Node = ref NodeObj
|
||||||
NodeObj = object
|
NodeObj = object
|
||||||
le, ri: PNode
|
le, ri: Node
|
||||||
data: int
|
data: int
|
||||||
var
|
var
|
||||||
n: Node
|
n: Node
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
## This module implements a zip archive creator/reader/modifier.
|
## This module implements a zip archive creator/reader/modifier.
|
||||||
|
|
||||||
import
|
import
|
||||||
streams, libzip, times, os
|
streams, libzip, times, os, strutils
|
||||||
|
|
||||||
type
|
type
|
||||||
TZipArchive* = object of RootObj ## represents a zip archive
|
TZipArchive* = object of RootObj ## represents a zip archive
|
||||||
|
|
@ -111,19 +111,25 @@ proc addFile*(z: var TZipArchive, dest: string, src: Stream) =
|
||||||
type
|
type
|
||||||
TZipFileStream = object of StreamObj
|
TZipFileStream = object of StreamObj
|
||||||
f: PZipFile
|
f: PZipFile
|
||||||
|
atEnd: bool
|
||||||
|
|
||||||
PZipFileStream* =
|
PZipFileStream* =
|
||||||
ref TZipFileStream ## a reader stream of a file within a zip archive
|
ref TZipFileStream ## a reader stream of a file within a zip archive
|
||||||
|
|
||||||
proc fsClose(s: Stream) = zip_fclose(PZipFileStream(s).f)
|
proc fsClose(s: Stream) = zip_fclose(PZipFileStream(s).f)
|
||||||
|
proc fsAtEnd(s: Stream): bool = PZipFileStream(s).atEnd
|
||||||
proc fsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
proc fsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
||||||
result = zip_fread(PZipFileStream(s).f, buffer, bufLen)
|
result = zip_fread(PZipFileStream(s).f, buffer, bufLen)
|
||||||
|
if result == 0:
|
||||||
|
PZipFileStream(s).atEnd = true
|
||||||
|
|
||||||
proc newZipFileStream(f: PZipFile): PZipFileStream =
|
proc newZipFileStream(f: PZipFile): PZipFileStream =
|
||||||
new(result)
|
new(result)
|
||||||
result.f = f
|
result.f = f
|
||||||
|
result.atEnd = false
|
||||||
result.closeImpl = fsClose
|
result.closeImpl = fsClose
|
||||||
result.readDataImpl = fsReadData
|
result.readDataImpl = fsReadData
|
||||||
|
result.atEndImpl = fsAtEnd
|
||||||
# other methods are nil!
|
# other methods are nil!
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
@ -158,12 +164,20 @@ proc extractFile*(z: var TZipArchive, srcFile: string, dest: Stream) =
|
||||||
|
|
||||||
proc extractFile*(z: var TZipArchive, srcFile: string, dest: string) =
|
proc extractFile*(z: var TZipArchive, srcFile: string, dest: string) =
|
||||||
## extracts a file from the zip archive `z` to the destination filename.
|
## extracts a file from the zip archive `z` to the destination filename.
|
||||||
var file = newFileStream(dest, fmReadWrite)
|
var file = newFileStream(dest, fmWrite)
|
||||||
extractFile(z, srcFile, file)
|
extractFile(z, srcFile, file)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
proc extractAll*(z: var TZipArchive, dest: string) =
|
proc extractAll*(z: var TZipArchive, dest: string) =
|
||||||
## extracts all files from archive `z` to the destination directory.
|
## extracts all files from archive `z` to the destination directory.
|
||||||
for file in walkFiles(z):
|
for file in walkFiles(z):
|
||||||
extractFile(z, file, dest / extractFilename(file))
|
if file.endsWith("/"):
|
||||||
|
createDir(dest / file)
|
||||||
|
else:
|
||||||
|
extractFile(z, file, dest / file)
|
||||||
|
|
||||||
|
when not defined(testing) and isMainModule:
|
||||||
|
var zip: TZipArchive
|
||||||
|
if not zip.open("nim-0.11.0.zip"):
|
||||||
|
raise newException(IOError, "opening zip failed")
|
||||||
|
zip.extractAll("test")
|
||||||
|
|
|
||||||
|
|
@ -152,10 +152,12 @@ type
|
||||||
DocumentObj {.importc.} = object of NodeObj
|
DocumentObj {.importc.} = object of NodeObj
|
||||||
alinkColor*: cstring
|
alinkColor*: cstring
|
||||||
bgColor*: cstring
|
bgColor*: cstring
|
||||||
|
body*: Element
|
||||||
charset*: cstring
|
charset*: cstring
|
||||||
cookie*: cstring
|
cookie*: cstring
|
||||||
defaultCharset*: cstring
|
defaultCharset*: cstring
|
||||||
fgColor*: cstring
|
fgColor*: cstring
|
||||||
|
head*: Element
|
||||||
lastModified*: cstring
|
lastModified*: cstring
|
||||||
linkColor*: cstring
|
linkColor*: cstring
|
||||||
referrer*: cstring
|
referrer*: cstring
|
||||||
|
|
|
||||||
|
|
@ -819,15 +819,18 @@ proc enlarge[A](t: var CountTable[A]) =
|
||||||
swap(t.data, n)
|
swap(t.data, n)
|
||||||
|
|
||||||
proc `[]=`*[A](t: var CountTable[A], key: A, val: int) =
|
proc `[]=`*[A](t: var CountTable[A], key: A, val: int) =
|
||||||
## puts a (key, value)-pair into `t`. `val` has to be positive.
|
## puts a (key, value)-pair into `t`.
|
||||||
assert val > 0
|
assert val > 0
|
||||||
var h = rawGet(t, key)
|
var h = rawGet(t, key)
|
||||||
if h >= 0:
|
if h >= 0:
|
||||||
t.data[h].val = val
|
t.data[h].val = val
|
||||||
else:
|
else:
|
||||||
h = -1 - h
|
if mustRehash(len(t.data), t.counter): enlarge(t)
|
||||||
t.data[h].key = key
|
rawInsert(t, t.data, key, val)
|
||||||
t.data[h].val = val
|
inc(t.counter)
|
||||||
|
#h = -1 - h
|
||||||
|
#t.data[h].key = key
|
||||||
|
#t.data[h].val = val
|
||||||
|
|
||||||
proc initCountTable*[A](initialSize=64): CountTable[A] =
|
proc initCountTable*[A](initialSize=64): CountTable[A] =
|
||||||
## creates a new count table that is empty.
|
## creates a new count table that is empty.
|
||||||
|
|
|
||||||
|
|
@ -1535,7 +1535,7 @@ const
|
||||||
NimMinor*: int = 11
|
NimMinor*: int = 11
|
||||||
## is the minor number of Nim's version.
|
## is the minor number of Nim's version.
|
||||||
|
|
||||||
NimPatch*: int = 0
|
NimPatch*: int = 2
|
||||||
## is the patch number of Nim's version.
|
## is the patch number of Nim's version.
|
||||||
|
|
||||||
NimVersion*: string = $NimMajor & "." & $NimMinor & "." & $NimPatch
|
NimVersion*: string = $NimMajor & "." & $NimMinor & "." & $NimPatch
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
## This module implements a small wrapper for some needed Win API procedures,
|
## This module implements a small wrapper for some needed Win API procedures,
|
||||||
## so that the Nim compiler does not depend on the huge Windows module.
|
## so that the Nim compiler does not depend on the huge Windows module.
|
||||||
|
|
||||||
|
{.deadCodeElim:on.}
|
||||||
|
|
||||||
const
|
const
|
||||||
useWinUnicode* = not defined(useWinAnsi)
|
useWinUnicode* = not defined(useWinAnsi)
|
||||||
|
|
||||||
|
|
|
||||||
19
tests/collections/tcounttable.nim
Normal file
19
tests/collections/tcounttable.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
discard """
|
||||||
|
output: "And we get here"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #2625
|
||||||
|
|
||||||
|
const s_len = 32
|
||||||
|
|
||||||
|
import tables
|
||||||
|
var substr_counts: CountTable[string] = initCountTable[string]()
|
||||||
|
var my_string = "Hello, this is sadly broken for strings over 64 characters. Note that it *does* appear to work for short strings."
|
||||||
|
for i in 0..(my_string.len - s_len):
|
||||||
|
let s = my_string[i..i+s_len-1]
|
||||||
|
substr_counts[s] = 1
|
||||||
|
# substr_counts[s] = substr_counts[s] + 1 # Also breaks, + 2 as well, etc.
|
||||||
|
# substr_counts.inc(s) # This works
|
||||||
|
#echo "Iteration ", i
|
||||||
|
|
||||||
|
echo "And we get here"
|
||||||
20
tests/distinct/tdistinct_consts.nim
Normal file
20
tests/distinct/tdistinct_consts.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
# bug #2641
|
||||||
|
|
||||||
|
type MyChar = distinct char
|
||||||
|
const c:MyChar = MyChar('a')
|
||||||
|
|
||||||
|
type MyBool = distinct bool
|
||||||
|
const b:MyBool = MyBool(true)
|
||||||
|
|
||||||
|
type MyBoolSet = distinct set[bool]
|
||||||
|
const bs:MyBoolSet = MyBoolSet({true})
|
||||||
|
|
||||||
|
type MyCharSet= distinct set[char]
|
||||||
|
const cs:MyCharSet = MyCharSet({'a'})
|
||||||
|
|
||||||
|
type MyBoolSeq = distinct seq[bool]
|
||||||
|
const bseq:MyBoolSeq = MyBoolSeq(@[true, false])
|
||||||
|
|
||||||
|
type MyBoolArr = distinct array[3, bool]
|
||||||
|
const barr:MyBoolArr = MyBoolArr([true, false, true])
|
||||||
14
tests/template/tdefault_nil.nim
Normal file
14
tests/template/tdefault_nil.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
# bug #2629
|
||||||
|
import sequtils, os
|
||||||
|
|
||||||
|
template glob_rst(basedir: string = nil): expr =
|
||||||
|
if baseDir.isNil:
|
||||||
|
to_seq(walk_files("*.rst"))
|
||||||
|
else:
|
||||||
|
to_seq(walk_files(basedir/"*.rst"))
|
||||||
|
|
||||||
|
let
|
||||||
|
rst_files = concat(glob_rst(), glob_rst("docs"))
|
||||||
|
|
||||||
|
when isMainModule: echo rst_files
|
||||||
46
tests/tuples/tuple_with_seq.nim
Normal file
46
tests/tuples/tuple_with_seq.nim
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
discard """
|
||||||
|
output: '''it's nil
|
||||||
|
@[1, 2, 3]'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
template foo(s: string = nil) =
|
||||||
|
if isNil(s):
|
||||||
|
echo "it's nil"
|
||||||
|
else:
|
||||||
|
echo s
|
||||||
|
|
||||||
|
foo
|
||||||
|
|
||||||
|
|
||||||
|
# bug #2632
|
||||||
|
|
||||||
|
proc takeTup(x: tuple[s: string;x: seq[int]]) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
takeTup(("foo", @[]))
|
||||||
|
|
||||||
|
|
||||||
|
#proc foobar(): () =
|
||||||
|
|
||||||
|
proc f(xs: seq[int]) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
proc g(t: tuple[n:int, xs:seq[int]]) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
f(@[]) # OK
|
||||||
|
g((1,@[1])) # OK
|
||||||
|
g((0,@[])) # NG
|
||||||
|
|
||||||
|
|
||||||
|
# bug #2630
|
||||||
|
type T = tuple[a: seq[int], b: int]
|
||||||
|
|
||||||
|
var t: T = (@[1,2,3], 7)
|
||||||
|
|
||||||
|
proc test(s: seq[int]): T =
|
||||||
|
echo s
|
||||||
|
(s, 7)
|
||||||
|
|
||||||
|
t = test(t.a)
|
||||||
14
todo.txt
14
todo.txt
|
|
@ -1,14 +1,14 @@
|
||||||
version 0.10.4
|
version 0.11.2
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
- The remaining bugs of the lambda lifting pass that is responsible to enable
|
||||||
|
closures and closure iterators need to be fixed.
|
||||||
version 0.10.6 (RC1?)
|
- ``concept`` needs to be refined, a nice name for the feature is not enough.
|
||||||
=====================
|
- Destructors need to be refined.
|
||||||
|
|
||||||
- make '--implicitStatic:on' the default; then we can also clean up the
|
- make '--implicitStatic:on' the default; then we can also clean up the
|
||||||
'static[T]' mess in the compiler!
|
'static[T]' mess in the compiler!
|
||||||
- finish 'parallel' or mark as experimental
|
|
||||||
|
- Finish the implementation of the 'parallel' statement.
|
||||||
- Deprecate ``immediate`` for templates and macros
|
- Deprecate ``immediate`` for templates and macros
|
||||||
- special case varargs[untyped] and varargs[typed]
|
- special case varargs[untyped] and varargs[typed]
|
||||||
- make 'nil' work for 'add':
|
- make 'nil' work for 'add':
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,8 @@ pre .end { background:url("images/tabEnd.png") no-repeat left bottom; }
|
||||||
opacity 1s ease-in-out; }
|
opacity 1s ease-in-out; }
|
||||||
#slideshow > div.active { visibility:visible; opacity:1; transition-delay:0s; }
|
#slideshow > div.active { visibility:visible; opacity:1; transition-delay:0s; }
|
||||||
#slideshow > div.init { transition-delay:0s; }
|
#slideshow > div.init { transition-delay:0s; }
|
||||||
#slideshow-nav { z-index:3; position:absolute; top:110px;; right:-12px; }
|
#slideshow-nav { z-index:3; position:absolute; top:341px; left:18px; }
|
||||||
#slideshow-nav > div { margin:5px 0; width:23px; height:23px; background:url("images/slideshow-nav.png") no-repeat; }
|
#slideshow-nav > div { display:inline-block; margin:5px 0; width:23px; height:23px; background:url("images/slideshow-nav.png") no-repeat; }
|
||||||
#slideshow-nav > div:hover { background-image:url("images/slideshow-nav_active.png"); opacity:0.5; }
|
#slideshow-nav > div:hover { background-image:url("images/slideshow-nav_active.png"); opacity:0.5; }
|
||||||
#slideshow-nav > div.active { background-image:url("images/slideshow-nav_active.png"); opacity:1; }
|
#slideshow-nav > div.active { background-image:url("images/slideshow-nav_active.png"); opacity:1; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ Nim's Documentation
|
||||||
|
|
||||||
.. container:: libraries
|
.. container:: libraries
|
||||||
|
|
||||||
- | `Standard Library <0.11.0/lib.html>`_
|
- | `Standard Library <docs/lib.html>`_
|
||||||
| This document describes Nim's standard library.
|
| This document describes Nim's standard library.
|
||||||
|
|
||||||
- | `Language Manual <0.11.0/manual.html>`_
|
- | `Language Manual <docs/manual.html>`_
|
||||||
| The Nim manual is a draft that will evolve into a proper specification.
|
| The Nim manual is a draft that will evolve into a proper specification.
|
||||||
|
|
||||||
- | `Compiler User Guide <0.11.0/nimc.html>`_
|
- | `Compiler User Guide <docs/nimc.html>`_
|
||||||
| The user guide lists command line arguments, special features of the
|
| The user guide lists command line arguments, special features of the
|
||||||
compiler, etc.
|
compiler, etc.
|
||||||
|
|
||||||
|
|
@ -26,11 +26,11 @@ Nim's Documentation
|
||||||
|
|
||||||
.. container:: tools
|
.. container:: tools
|
||||||
|
|
||||||
- | `Source Code Filters <0.11.0/filters.html>`_
|
- | `Source Code Filters <docs/filters.html>`_
|
||||||
| The Nim compiler supports source code filters as a simple yet powerful
|
| The Nim compiler supports source code filters as a simple yet powerful
|
||||||
builtin templating system.
|
builtin templating system.
|
||||||
|
|
||||||
- | `Tools Documentation <0.11.0/tools.html>`_
|
- | `Tools Documentation <docs/tools.html>`_
|
||||||
| Description of some tools that come with the standard distribution.
|
| Description of some tools that come with the standard distribution.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,11 +41,11 @@ Nim's Documentation
|
||||||
|
|
||||||
.. container:: internals
|
.. container:: internals
|
||||||
|
|
||||||
- | `Garbage Collector <0.11.0/gc.html>`_
|
- | `Garbage Collector <docs/gc.html>`_
|
||||||
| Additional documentation about Nim's GC and how to operate it in a
|
| Additional documentation about Nim's GC and how to operate it in a
|
||||||
realtime setting.
|
realtime setting.
|
||||||
|
|
||||||
- | `Internal Documentation <0.11.0/intern.html>`_
|
- | `Internal Documentation <docs/intern.html>`_
|
||||||
| The internal documentation describes how the compiler is implemented.
|
| The internal documentation describes how the compiler is implemented.
|
||||||
Read this if you want to hack the compiler.
|
Read this if you want to hack the compiler.
|
||||||
|
|
||||||
|
|
@ -53,5 +53,5 @@ Nim's Documentation
|
||||||
Search Options
|
Search Options
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
`Documentation Index <0.11.0/theindex.html>`_ - The generated
|
`Documentation Index <docs/theindex.html>`_ - The generated
|
||||||
index. **Index + (Ctrl+F) == Joy**
|
index. **Index + (Ctrl+F) == Joy**
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ Binaries
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Unfortunately for now we only provide builds for Windows.
|
Unfortunately for now we only provide builds for Windows.
|
||||||
* 32 bit: `nim-0.11.0_x32.exe <download/nim-0.11.0_x32.exe>`_
|
* 32 bit: `nim-0.11.2_x32.exe <download/nim-0.11.2_x32.exe>`_
|
||||||
* 64 bit: `nim-0.11.0_x64.exe <download/nim-0.11.0_x64.exe>`_
|
* 64 bit: `nim-0.11.2_x64.exe <download/nim-0.11.2_x64.exe>`_
|
||||||
|
|
||||||
|
|
||||||
Installation based on generated C code
|
Installation based on generated C code
|
||||||
|
|
@ -26,8 +26,8 @@ like systems. Binary packages may be provided later.
|
||||||
|
|
||||||
Download one of these:
|
Download one of these:
|
||||||
|
|
||||||
* `nim-0.11.0.zip (28 MB) <download/nim-0.11.0.zip>`_
|
* `nim-0.11.2.zip (28 MB) <download/nim-0.11.2.zip>`_
|
||||||
* `nim-0.11.0.tar.xz (2.6MB) <download/nim-0.11.0.tar.xz>`_
|
* `nim-0.11.2.tar.xz (2.6MB) <download/nim-0.11.2.tar.xz>`_
|
||||||
|
|
||||||
Extract the file and follow these instructions:
|
Extract the file and follow these instructions:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ Learning Nim
|
||||||
|
|
||||||
.. container:: tutorials
|
.. container:: tutorials
|
||||||
|
|
||||||
- | `Tutorial (part I) <0.11.0/tut1.html>`_
|
- | `Tutorial (part I) <docs/tut1.html>`_
|
||||||
| Learn the basics of Nim's types, variables, procedures, control flow, etc...
|
| Learn the basics of Nim's types, variables, procedures, control flow, etc...
|
||||||
|
|
||||||
- | `Tutorial (part II) <0.11.0/tut2.html>`_
|
- | `Tutorial (part II) <docs/tut2.html>`_
|
||||||
| Learn Nim's more advanced features such as OOP, generics, macros, etc...
|
| Learn Nim's more advanced features such as OOP, generics, macros, etc...
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -52,5 +52,5 @@ Learning Nim
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
More examples of Nim code can be found in the `Nim Language Documentation <0.11.0/manual.html>`_.
|
More examples of Nim code can be found in the `Nim Language Documentation <docs/manual.html>`_.
|
||||||
|
|
||||||
|
|
|
||||||
25
web/news.txt
25
web/news.txt
|
|
@ -2,6 +2,31 @@
|
||||||
News
|
News
|
||||||
====
|
====
|
||||||
|
|
||||||
|
..
|
||||||
|
2015-05-05 Version 0.11.2 released
|
||||||
|
==================================
|
||||||
|
|
||||||
|
Changes affecting backwards compatibility
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Language Additions
|
||||||
|
------------------
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
|
||||||
|
2015-05-04 Version 0.11.2 released
|
||||||
|
==================================
|
||||||
|
|
||||||
|
This is just a bugfix release that fixes the most pressing regressions we
|
||||||
|
introduced with version 0.11.0. The way types are computed was
|
||||||
|
changed significantly causing all sort of problems. Sorry for the
|
||||||
|
inconvenience; we grew overconfident our large test suite would prevent these
|
||||||
|
things.
|
||||||
|
|
||||||
|
|
||||||
2015-04-30 Version 0.11.0 released
|
2015-04-30 Version 0.11.0 released
|
||||||
==================================
|
==================================
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<a class="news" href="news.html#Z2015-04-30-version-0-11-0-released">
|
<a class="news" href="news.html#Z2015-05-04-version-0-11-2-released">
|
||||||
<h4>Apr 30, 2015</h4>
|
<h4>May 4, 2015</h4>
|
||||||
<p>Nim version 0.11.0 has been released!</p>
|
<p>Nim version 0.11.2 has been released!</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="news" href="news.html#Z2014-12-29-version-0-10-2-released">
|
<a class="news" href="news.html#Z2014-12-29-version-0-10-2-released">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue