Merge branch 'devel' into fix_issues_9126

This commit is contained in:
Andreas Rumpf 2018-10-01 14:15:35 +02:00 • committed by GitHub
commit e867c8e5c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 219 additions and 114 deletions

View file

@ -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() =

View file

@ -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")

View file

@ -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: