some bugfixes; no system.$ for object as it breaks code

This commit is contained in:
Araq 2013-02-24 12:34:50 +01:00
commit c87e1c96ad
4 changed files with 11 additions and 10 deletions

View file

@ -85,7 +85,7 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
#writeMatches(alt) #writeMatches(alt)
if c.inCompilesContext > 0: if c.inCompilesContext > 0:
# quick error message for performance of 'compiles' built-in: # quick error message for performance of 'compiles' built-in:
GlobalError(n.Info, errAmbiguousCallXYZ, "") GlobalError(n.Info, errGenerated, "ambiguous call")
elif gErrorCounter == 0: elif gErrorCounter == 0:
# don't cascade errors # don't cascade errors
var args = "(" var args = "("

View file

@ -1532,7 +1532,7 @@ iterator fieldPairs*[S: tuple|object, T: tuple|object](x: S, y: T): tuple[
## The current implementation also has a bug that affects symbol binding ## The current implementation also has a bug that affects symbol binding
## in the loop body. ## in the loop body.
proc `==`*[T: tuple|object](x, y: T): bool = proc `==`*[T: tuple](x, y: T): bool =
## generic ``==`` operator for tuples that is lifted from the components ## generic ``==`` operator for tuples that is lifted from the components
## of `x` and `y`. ## of `x` and `y`.
for a, b in fields(x, y): for a, b in fields(x, y):
@ -1557,7 +1557,7 @@ proc `<`*[T: tuple](x, y: T): bool =
if c > 0: return false if c > 0: return false
return false return false
proc `$`*[T: tuple|object](x: T): string = proc `$`*[T: tuple](x: T): string =
## generic ``$`` operator for tuples that is lifted from the components ## generic ``$`` operator for tuples that is lifted from the components
## of `x`. Example: ## of `x`. Example:
## ##

View file

@ -73,12 +73,13 @@ proc cstrToNimstr(str: CString): NimString {.compilerRtl.} =
result = toNimstr(str, c_strlen(str)) result = toNimstr(str, c_strlen(str))
proc copyString(src: NimString): NimString {.compilerRtl.} = proc copyString(src: NimString): NimString {.compilerRtl.} =
if (src.reserved and seqShallowFlag) != 0: if src != nil:
result = src if (src.reserved and seqShallowFlag) != 0:
elif src != nil: result = src
result = rawNewString(src.space) else:
result.len = src.len result = rawNewString(src.space)
c_memcpy(result.data, src.data, (src.len + 1) * sizeof(Char)) result.len = src.len
c_memcpy(result.data, src.data, (src.len + 1) * sizeof(Char))
proc copyStringRC1(src: NimString): NimString {.compilerRtl.} = proc copyStringRC1(src: NimString): NimString {.compilerRtl.} =
if src != nil: if src != nil:

View file

@ -1,7 +1,7 @@
discard """ discard """
file: "tests/reject/trecincb.nim" file: "tests/reject/trecincb.nim"
line: 9 line: 9
errormsg: "recursive dependency: 'trecincb.nim'" errormsg: "recursive dependency: 'tests/reject/trecincb.nim'"
""" """
# Test recursive includes # Test recursive includes