Merge branch 'devel' into new-ll
This commit is contained in:
commit
250e81ceda
9 changed files with 35 additions and 23 deletions
|
|
@ -19,10 +19,7 @@ proc genConv(n: PNode, d: PType, downcast: bool): PNode =
|
||||||
if (source.kind == tyObject) and (dest.kind == tyObject):
|
if (source.kind == tyObject) and (dest.kind == tyObject):
|
||||||
var diff = inheritanceDiff(dest, source)
|
var diff = inheritanceDiff(dest, source)
|
||||||
if diff == high(int):
|
if diff == high(int):
|
||||||
# see bug #3550 which triggers it. XXX This is a hack but I don't know yet
|
# no subtype relation, nothing to do
|
||||||
# how the real fix looks like:
|
|
||||||
localError(n.info, "there is no subtype relation between " &
|
|
||||||
typeToString(d) & " and " & typeToString(n.typ))
|
|
||||||
result = n
|
result = n
|
||||||
elif diff < 0:
|
elif diff < 0:
|
||||||
result = newNodeIT(nkObjUpConv, n.info, d)
|
result = newNodeIT(nkObjUpConv, n.info, d)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@
|
||||||
##
|
##
|
||||||
## theDb.close()
|
## theDb.close()
|
||||||
|
|
||||||
|
{.deadCodeElim:on.}
|
||||||
|
|
||||||
import strutils, sqlite3
|
import strutils, sqlite3
|
||||||
|
|
||||||
import db_common
|
import db_common
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ type
|
||||||
EInvalidProtocol: ProtocolError, EHttpRequestErr: HttpRequestError
|
EInvalidProtocol: ProtocolError, EHttpRequestErr: HttpRequestError
|
||||||
].}
|
].}
|
||||||
|
|
||||||
const defUserAgent* = "Nim httpclient/0.1"
|
const defUserAgent* = "Nim httpclient/" & NimVersion
|
||||||
|
|
||||||
proc httpError(msg: string) =
|
proc httpError(msg: string) =
|
||||||
var e: ref ProtocolError
|
var e: ref ProtocolError
|
||||||
|
|
@ -389,6 +389,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
## | An optional timeout can be specified in milliseconds, if reading from the
|
## | An optional timeout can be specified in milliseconds, if reading from the
|
||||||
## server takes longer than specified an ETimeout exception will be raised.
|
## server takes longer than specified an ETimeout exception will be raised.
|
||||||
var r = if proxy == nil: parseUri(url) else: proxy.url
|
var r = if proxy == nil: parseUri(url) else: proxy.url
|
||||||
|
var hostUrl = if proxy == nil: r else: parseUri(url)
|
||||||
var headers = substr(httpMethod, len("http"))
|
var headers = substr(httpMethod, len("http"))
|
||||||
# TODO: Use generateHeaders further down once it supports proxies.
|
# TODO: Use generateHeaders further down once it supports proxies.
|
||||||
if proxy == nil:
|
if proxy == nil:
|
||||||
|
|
@ -402,10 +403,10 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
|
|
||||||
headers.add(" HTTP/1.1\c\L")
|
headers.add(" HTTP/1.1\c\L")
|
||||||
|
|
||||||
if r.port == "":
|
if hostUrl.port == "":
|
||||||
add(headers, "Host: " & r.hostname & "\c\L")
|
add(headers, "Host: " & hostUrl.hostname & "\c\L")
|
||||||
else:
|
else:
|
||||||
add(headers, "Host: " & r.hostname & ":" & r.port & "\c\L")
|
add(headers, "Host: " & hostUrl.hostname & ":" & hostUrl.port & "\c\L")
|
||||||
|
|
||||||
if userAgent != "":
|
if userAgent != "":
|
||||||
add(headers, "User-Agent: " & userAgent & "\c\L")
|
add(headers, "User-Agent: " & userAgent & "\c\L")
|
||||||
|
|
@ -414,7 +415,6 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
|
||||||
add(headers, "Proxy-Authorization: basic " & auth & "\c\L")
|
add(headers, "Proxy-Authorization: basic " & auth & "\c\L")
|
||||||
add(headers, extraHeaders)
|
add(headers, extraHeaders)
|
||||||
add(headers, "\c\L")
|
add(headers, "\c\L")
|
||||||
|
|
||||||
var s = newSocket()
|
var s = newSocket()
|
||||||
if s == nil: raiseOSError(osLastError())
|
if s == nil: raiseOSError(osLastError())
|
||||||
var port = net.Port(80)
|
var port = net.Port(80)
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ proc getAddrInfo*(address: string, port: Port, domain: Domain = AF_INET,
|
||||||
# OpenBSD doesn't support AI_V4MAPPED and doesn't define the macro AI_V4MAPPED.
|
# OpenBSD doesn't support AI_V4MAPPED and doesn't define the macro AI_V4MAPPED.
|
||||||
# FreeBSD doesn't support AI_V4MAPPED but defines the macro.
|
# FreeBSD doesn't support AI_V4MAPPED but defines the macro.
|
||||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092
|
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092
|
||||||
when not defined(freebsd) or defined(openbsd):
|
when not defined(freebsd) and not defined(openbsd) and not defined(netbsd):
|
||||||
if domain == AF_INET6:
|
if domain == AF_INET6:
|
||||||
hints.ai_flags = AI_V4MAPPED
|
hints.ai_flags = AI_V4MAPPED
|
||||||
var gaiResult = getaddrinfo(address, $port, addr(hints), result)
|
var gaiResult = getaddrinfo(address, $port, addr(hints), result)
|
||||||
|
|
|
||||||
|
|
@ -886,7 +886,7 @@ elif not defined(useNimRtl):
|
||||||
discard write(data.pErrorPipe[writeIdx], addr error, sizeof(error))
|
discard write(data.pErrorPipe[writeIdx], addr error, sizeof(error))
|
||||||
exitnow(1)
|
exitnow(1)
|
||||||
|
|
||||||
when defined(macosx) or defined(freebsd):
|
when defined(macosx) or defined(freebsd) or defined(netbsd):
|
||||||
var environ {.importc.}: cstringArray
|
var environ {.importc.}: cstringArray
|
||||||
|
|
||||||
proc startProcessAfterFork(data: ptr StartProcessData) =
|
proc startProcessAfterFork(data: ptr StartProcessData) =
|
||||||
|
|
@ -916,7 +916,7 @@ elif not defined(useNimRtl):
|
||||||
discard fcntl(data.pErrorPipe[writeIdx], F_SETFD, FD_CLOEXEC)
|
discard fcntl(data.pErrorPipe[writeIdx], F_SETFD, FD_CLOEXEC)
|
||||||
|
|
||||||
if data.optionPoUsePath:
|
if data.optionPoUsePath:
|
||||||
when defined(macosx) or defined(freebsd):
|
when defined(macosx) or defined(freebsd) or defined(netbsd):
|
||||||
# MacOSX doesn't have execvpe, so we need workaround.
|
# MacOSX doesn't have execvpe, so we need workaround.
|
||||||
# On MacOSX we can arrive here only from fork, so this is safe:
|
# On MacOSX we can arrive here only from fork, so this is safe:
|
||||||
environ = data.sysEnv
|
environ = data.sysEnv
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ when defined(posix):
|
||||||
|
|
||||||
proc nimLoadLibrary(path: string): LibHandle =
|
proc nimLoadLibrary(path: string): LibHandle =
|
||||||
result = dlopen(path, RTLD_NOW)
|
result = dlopen(path, RTLD_NOW)
|
||||||
|
when defined(nimDebugDlOpen):
|
||||||
let error = dlerror()
|
let error = dlerror()
|
||||||
if error != nil:
|
if error != nil:
|
||||||
c_fprintf(c_stdout, "%s\n", error)
|
c_fprintf(c_stdout, "%s\n", error)
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ template task*(name: untyped; description: string; body: untyped): untyped =
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
## task build, "default build is via the C backend":
|
## task build, "default build is via the C backend":
|
||||||
## setCommand "c"
|
## setCommand "c"
|
||||||
proc `name Task`() = body
|
proc `name Task`*() = body
|
||||||
|
|
||||||
let cmd = getCommand()
|
let cmd = getCommand()
|
||||||
if cmd.len == 0 or cmd ==? "help":
|
if cmd.len == 0 or cmd ==? "help":
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
discard """
|
|
||||||
file: "tissue1642.nim"
|
|
||||||
disabled: true
|
|
||||||
"""
|
|
||||||
block:
|
|
||||||
var i = 0
|
|
||||||
proc p() = inc(i)
|
|
||||||
19
tests/method/tmultim8.nim
Normal file
19
tests/method/tmultim8.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
# bug #3550
|
||||||
|
|
||||||
|
type
|
||||||
|
BaseClass = ref object of RootObj
|
||||||
|
Class1 = ref object of BaseClass
|
||||||
|
Class2 = ref object of BaseClass
|
||||||
|
|
||||||
|
method test(obj: Class1, obj2: BaseClass) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
method test(obj: Class2, obj2: BaseClass) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
var obj1 = Class1()
|
||||||
|
var obj2 = Class2()
|
||||||
|
|
||||||
|
obj1.test(obj2)
|
||||||
|
obj2.test(obj1)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue