Merge remote-tracking branch 'nim-lang/devel' into emscripten-support

This commit is contained in:
Andrey Sobolev 2015-09-23 10:16:36 +06:00
commit df65082370
10 changed files with 61 additions and 43 deletions

View file

@ -62,7 +62,7 @@ Currently, the following C compilers are supported under Windows:
However, most testing is done with GCC. However, most testing is done with GCC.
Bootstrapping from Github Bootstrapping from GitHub
------------------------- -------------------------
Take a look at the readme file on github `here <https://github.com/nim-lang/Nim#readme>`_ Take a look at the readme file on github `here <https://github.com/nim-lang/Nim#readme>`_

View file

@ -75,7 +75,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} =
identDefs.add(newEmptyNode()) identDefs.add(newEmptyNode())
of nnkIdent: of nnkIdent:
identDefs.add(c) identDefs.add(c)
identDefs.add(newEmptyNode()) identDefs.add(newIdentNode("auto"))
identDefs.add(newEmptyNode()) identDefs.add(newEmptyNode())
of nnkInfix: of nnkInfix:
if c[0].kind == nnkIdent and c[0].ident == !"->": if c[0].kind == nnkIdent and c[0].ident == !"->":
@ -93,7 +93,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} =
of nnkIdent: of nnkIdent:
var identDefs = newNimNode(nnkIdentDefs) var identDefs = newNimNode(nnkIdentDefs)
identDefs.add(p) identDefs.add(p)
identDefs.add(newEmptyNode()) identDefs.add(newIdentNode("auto"))
identDefs.add(newEmptyNode()) identDefs.add(newEmptyNode())
params.add(identDefs) params.add(identDefs)
of nnkInfix: of nnkInfix:

View file

@ -2235,7 +2235,9 @@ proc `$`*[T: tuple|object](x: T): string =
firstElement = false firstElement = false
result.add(")") result.add(")")
proc collectionToString[T](x: T, b, e: string): string = proc collectionToString[T: set | seq](x: T, b, e: string): string =
when x is seq:
if x.isNil: return "nil"
result = b result = b
var firstElement = true var firstElement = true
for value in items(x): for value in items(x):

View file

@ -0,0 +1,13 @@
import future
let x = map(@[1, 2, 3], x => x+10)
assert x == @[11, 12, 13]
let y = map(@[(1,"a"), (2,"b"), (3,"c")], x => $x[0] & x[1])
assert y == @["1a", "2b", "3c"]
proc eatsTwoArgProc[T,S,U](a: T, b: S, f: proc(t: T, s: S): U): U =
f(a,b)
let z = eatsTwoArgProc(1, "a", (t,s) => $t & s)
assert z == "1a"

View file

@ -1,22 +0,0 @@
discard """
output:'''2.3242
2.982
123912.1
123912.1823
5.0
1e+100
inf
-inf
nan
'''
"""
echo($(2.3242))
echo($(2.982))
echo($(123912.1))
echo($(123912.1823))
echo($(5.0))
echo($(1e100))
echo($(1e1000000))
echo($(-1e1000000))
echo($(0.0/0.0))

View file

@ -1,9 +1,42 @@
discard """ discard """
output:'''@[23, 45] output:'''@[23, 45]
@[, foo, bar]''' @[, foo, bar]
{a, b, c}
2.3242
2.982
123912.1
123912.1823
5.0
1e+100
inf
-inf
nan
nil
nil'''
""" """
echo($(@[23, 45])) echo($(@[23, 45]))
echo($(@["", "foo", "bar"])) echo($(@["", "foo", "bar"]))
#echo($(["", "foo", "bar"])) #echo($(["", "foo", "bar"]))
#echo($([23, 45])) #echo($([23, 45]))
# bug #2395
let alphaSet: set[char] = {'a'..'c'}
echo alphaSet
echo($(2.3242))
echo($(2.982))
echo($(123912.1))
echo($(123912.1823))
echo($(5.0))
echo($(1e100))
echo($(1e1000000))
echo($(-1e1000000))
echo($(0.0/0.0))
# nil tests
var x: seq[string]
var y: string
echo(x)
echo(y)

View file

@ -1,8 +0,0 @@
discard """
output: "{a, b, c}"
"""
# bug #2395
let alphaSet: set[char] = {'a'..'c'}
echo alphaSet

View file

@ -41,14 +41,14 @@ Nim's Community
.. container:: standout .. container:: standout
Github GitHub
------ ------
Nim's `source code <http://github.com/nim-lang/Nim>`_ is hosted on Github. Nim's `source code <http://github.com/nim-lang/Nim>`_ is hosted on GitHub.
Together with the `wiki <http://github.com/nim-lang/Nim/wiki>`_ and Together with the `wiki <http://github.com/nim-lang/Nim/wiki>`_ and
`issue tracker <http://github.com/nim-lang/Nim/issues>`_. `issue tracker <http://github.com/nim-lang/Nim/issues>`_.
Github also hosts other projects relating to Nim. These projects are a part GitHub also hosts other projects relating to Nim. These projects are a part
of the `nim-lang organisation <http://github.com/nim-lang>`_. of the `nim-lang organisation <http://github.com/nim-lang>`_.
This includes the `Nimble package manager <https://github.com/nim-lang/nimble>`_ This includes the `Nimble package manager <https://github.com/nim-lang/nimble>`_
and its `package repository <http://github.com/nim-lang/packages>`_. and its `package repository <http://github.com/nim-lang/packages>`_.

View file

@ -3,7 +3,7 @@ News
==== ====
.. ..
2015-09-14 Version 0.11.4 released 2015-xx-xx Version 0.11.4 released
================================== ==================================
Changes affecting backwards compatibility Changes affecting backwards compatibility
@ -120,9 +120,9 @@ News
- Added ``macros.getImpl`` that can be used to access the implementation of - Added ``macros.getImpl`` that can be used to access the implementation of
a routine or a constant. This allows for example for user-defined inlining a routine or a constant. This allows for example for user-defined inlining
of function calls. of function calls.
- Tuple unpacking finally works in a non-var/let context: ``(x, y) == f()`` - Tuple unpacking finally works in a non-var/let context: ``(x, y) = f()``
is allowed. Note that this doesn't declare ``x`` and ``y`` variables, for is allowed. Note that this doesn't declare ``x`` and ``y`` variables, for
this ``let (x, y) == f()`` still needs to be used. this ``let (x, y) = f()`` still needs to be used.
- ``when nimvm`` can now be used for compiletime versions of some code - ``when nimvm`` can now be used for compiletime versions of some code
sections. Click `here <docs/manual.html#when-nimvm-statement>`_ for details. sections. Click `here <docs/manual.html#when-nimvm-statement>`_ for details.
- Usage of the type ``NimNode`` in a proc now implicitly annotates the proc - Usage of the type ``NimNode`` in a proc now implicitly annotates the proc
@ -792,7 +792,7 @@ is the installation of packages containing libraries and/or applications
written in Nim. written in Nim.
Even though Nimble is still very young it already is very Even though Nimble is still very young it already is very
functional. It can install packages by name, it does so by accessing a functional. It can install packages by name, it does so by accessing a
packages repository which is hosted on a Github repo. Packages can also be packages repository which is hosted on a GitHub repo. Packages can also be
installed via a Git repo URL or Mercurial repo URL. The package repository installed via a Git repo URL or Mercurial repo URL. The package repository
is searchable through Nimble. Anyone is free to add their own packages to is searchable through Nimble. Anyone is free to add their own packages to
the package repository by forking the the package repository by forking the

View file

@ -9,7 +9,7 @@ Authors: "Andreas Rumpf and contributors"
# Everything after ; is the ID # Everything after ; is the ID
Community: "community.html;link_forum" Community: "community.html;link_forum"
Aporia_IDE: "https://github.com/nim-lang/Aporia;link_aporia" Aporia_IDE: "https://github.com/nim-lang/Aporia;link_aporia"
Github_Repo: "http://github.com/Araq/Nim;link_github" GitHub_Repo: "http://github.com/Araq/Nim;link_github"
[Tabs] [Tabs]