From 925e7b0ca139e73d8bbe0806b63c941b3e915fc7 Mon Sep 17 00:00:00 2001 From: Peter Mora Date: Tue, 22 Sep 2015 18:34:43 +0200 Subject: [PATCH 1/4] fixing TypelessParam warning in x=>x+1, added test --- lib/pure/future.nim | 4 ++-- tests/generics/tmap_auto.nim | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/generics/tmap_auto.nim diff --git a/lib/pure/future.nim b/lib/pure/future.nim index 661afd7b33..4767266e56 100644 --- a/lib/pure/future.nim +++ b/lib/pure/future.nim @@ -75,7 +75,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} = identDefs.add(newEmptyNode()) of nnkIdent: identDefs.add(c) - identDefs.add(newEmptyNode()) + identDefs.add(newIdentNode("auto")) identDefs.add(newEmptyNode()) of nnkInfix: if c[0].kind == nnkIdent and c[0].ident == !"->": @@ -93,7 +93,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} = of nnkIdent: var identDefs = newNimNode(nnkIdentDefs) identDefs.add(p) - identDefs.add(newEmptyNode()) + identDefs.add(newIdentNode("auto")) identDefs.add(newEmptyNode()) params.add(identDefs) of nnkInfix: diff --git a/tests/generics/tmap_auto.nim b/tests/generics/tmap_auto.nim new file mode 100644 index 0000000000..dea9b571fb --- /dev/null +++ b/tests/generics/tmap_auto.nim @@ -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" From 31bb4311e6cb3c5d74d65edfd110fc09d31d4bf0 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 22 Sep 2015 13:33:37 -0700 Subject: [PATCH 2/4] s/Github/GitHub/g --- install.txt | 2 +- web/community.txt | 6 +++--- web/news.txt | 2 +- web/website.ini | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install.txt b/install.txt index ef367639cd..55e8d8ce5f 100644 --- a/install.txt +++ b/install.txt @@ -62,7 +62,7 @@ Currently, the following C compilers are supported under Windows: However, most testing is done with GCC. -Bootstrapping from Github +Bootstrapping from GitHub ------------------------- Take a look at the readme file on github `here `_ diff --git a/web/community.txt b/web/community.txt index 4b8c481b9b..b8a6c7372d 100644 --- a/web/community.txt +++ b/web/community.txt @@ -41,14 +41,14 @@ Nim's Community .. container:: standout - Github + GitHub ------ - Nim's `source code `_ is hosted on Github. + Nim's `source code `_ is hosted on GitHub. Together with the `wiki `_ and `issue tracker `_. - 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 `_. This includes the `Nimble package manager `_ and its `package repository `_. diff --git a/web/news.txt b/web/news.txt index af8168f365..beb98192fc 100644 --- a/web/news.txt +++ b/web/news.txt @@ -792,7 +792,7 @@ is the installation of packages containing libraries and/or applications written in Nim. Even though Nimble is still very young it already is very 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 is searchable through Nimble. Anyone is free to add their own packages to the package repository by forking the diff --git a/web/website.ini b/web/website.ini index c160d624d9..dcfea8bf4c 100644 --- a/web/website.ini +++ b/web/website.ini @@ -9,7 +9,7 @@ Authors: "Andreas Rumpf and contributors" # Everything after ; is the ID Community: "community.html;link_forum" 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] From 990812760a260f5ee8af753b9fb8fb87c6fb320a Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 22 Sep 2015 23:25:48 +0100 Subject: [PATCH 3/4] Fixes typo in news.txt (thanks @tmm1) --- web/news.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/news.txt b/web/news.txt index beb98192fc..cfa40c65ca 100644 --- a/web/news.txt +++ b/web/news.txt @@ -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 @@ -120,9 +120,9 @@ News - 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 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 - 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 sections. Click `here `_ for details. - Usage of the type ``NimNode`` in a proc now implicitly annotates the proc From 371470e73f2c79f4d9babc86f59b5d580defb050 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 23 Sep 2015 00:04:31 +0100 Subject: [PATCH 4/4] Fixes #2889. Merges *tostring tests in tests/system. --- lib/system.nim | 4 +++- tests/system/tfloatToString.nim | 22 --------------------- tests/system/toString.nim | 35 ++++++++++++++++++++++++++++++++- tests/system/tsettostring.nim | 8 -------- 4 files changed, 37 insertions(+), 32 deletions(-) delete mode 100644 tests/system/tfloatToString.nim delete mode 100644 tests/system/tsettostring.nim diff --git a/lib/system.nim b/lib/system.nim index af10f57735..f143b2b465 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2235,7 +2235,9 @@ proc `$`*[T: tuple|object](x: T): string = firstElement = false 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 var firstElement = true for value in items(x): diff --git a/tests/system/tfloatToString.nim b/tests/system/tfloatToString.nim deleted file mode 100644 index bb45a91d70..0000000000 --- a/tests/system/tfloatToString.nim +++ /dev/null @@ -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)) diff --git a/tests/system/toString.nim b/tests/system/toString.nim index 52e7a4b92a..a2337f5dd4 100644 --- a/tests/system/toString.nim +++ b/tests/system/toString.nim @@ -1,9 +1,42 @@ discard """ 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($(@["", "foo", "bar"])) #echo($(["", "foo", "bar"])) #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) diff --git a/tests/system/tsettostring.nim b/tests/system/tsettostring.nim deleted file mode 100644 index c6846ee991..0000000000 --- a/tests/system/tsettostring.nim +++ /dev/null @@ -1,8 +0,0 @@ -discard """ - output: "{a, b, c}" -""" - -# bug #2395 - -let alphaSet: set[char] = {'a'..'c'} -echo alphaSet