diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-10-01 14:15:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 14:15:35 +0200 |
commit | e867c8e5c3cf5c08c703e76434fc7db962f755f7 (patch) | |
tree | 077eea3f3e0986363d8296b1b74cefcceb7310e5 /lib/pure | |
parent | aa8249d177cbac4a3c08348ea6dbe12d6526928d (diff) | |
parent | 5298c509a7b0168f0edce9b28442feca914d15f7 (diff) | |
download | Nim-e867c8e5c3cf5c08c703e76434fc7db962f755f7.tar.gz |
Merge branch 'devel' into fix_issues_9126
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/concurrency/cpuload.nim | 2 | ||||
-rw-r--r-- | lib/pure/json.nim | 16 | ||||
-rw-r--r-- | lib/pure/uri.nim | 1 |
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/pure/concurrency/cpuload.nim b/lib/pure/concurrency/cpuload.nim index 1ec739485..78a95681d 100644 --- a/lib/pure/concurrency/cpuload.nim +++ b/lib/pure/concurrency/cpuload.nim @@ -81,7 +81,7 @@ proc advice*(s: var ThreadPoolState): ThreadPoolAdvice = result = doNothing inc s.calls -when not defined(testing) and isMainModule: +when not defined(testing) and isMainModule and not defined(nimdoc): import random proc busyLoop() = diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 9279fea77..81d5702c9 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -1147,7 +1147,7 @@ proc processType(typeName: NimNode, obj: NimNode, `getEnumCall` ) of nnkSym: - let name = ($typeName).normalize + let name = normalize($typeName.getTypeImpl()) case name of "string": result = quote do: @@ -1639,3 +1639,17 @@ when isMainModule: # bug #6438 doAssert($ %*[] == "[]") doAssert($ %*{} == "{}") + + # bug #9111 + block: + type + Bar = string + Foo = object + a: int + b: Bar + + let + js = """{"a": 123, "b": "abc"}""".parseJson + foo = js.to Foo + + doAssert(foo.b == "abc") diff --git a/lib/pure/uri.nim b/lib/pure/uri.nim index dd8040928..d296017dd 100644 --- a/lib/pure/uri.nim +++ b/lib/pure/uri.nim @@ -60,6 +60,7 @@ proc encodeUrl*(s: string, usePlus=true): string = let fromSpace = if usePlus: "+" else: "%20" for c in s: case c + # https://tools.ietf.org/html/rfc3986#section-2.3 of 'a'..'z', 'A'..'Z', '0'..'9', '-', '.', '_', '~': add(result, c) of ' ': add(result, fromSpace) else: |