make trecinca|b tests green

This commit is contained in:
Araq 2011-12-31 10:23:56 +01:00
commit d25fefc0ff
6 changed files with 11 additions and 6 deletions

View file

@ -802,7 +802,7 @@ proc evalInclude(c: PContext, n: PNode): PNode =
var f = checkModuleName(n.sons[i]) var f = checkModuleName(n.sons[i])
var fileIndex = f.fileInfoIdx var fileIndex = f.fileInfoIdx
if ContainsOrIncl(c.includedFiles, fileIndex): if ContainsOrIncl(c.includedFiles, fileIndex):
GlobalError(n.info, errRecursiveDependencyX, f) GlobalError(n.info, errRecursiveDependencyX, f.shortenDir)
addSon(result, semStmt(c, gIncludeFile(f))) addSon(result, semStmt(c, gIncludeFile(f)))
Excl(c.includedFiles, fileIndex) Excl(c.includedFiles, fileIndex)

View file

@ -781,7 +781,11 @@ proc semGenericConstraints(c: PContext, n: PNode, result: PType) =
semGenericConstraints(c, n.sons[1], result) semGenericConstraints(c, n.sons[1], result)
semGenericConstraints(c, n.sons[2], result) semGenericConstraints(c, n.sons[2], result)
else: else:
result.addSon(semTypeNode(c, n, nil)) var x = semTypeNode(c, n, nil)
if x.kind in StructuralEquivTypes and sonsLen(x) == 0:
x = newConstraint(c, x.kind)
#echo "came here for: ", typeToString(x)
result.addSon(x)
proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode =
result = copyNode(n) result = copyNode(n)

View file

@ -388,7 +388,8 @@ proc typeRel(mapping: var TIdTable, f, a: PType): TTypeRelation =
of tyGenericInst: of tyGenericInst:
result = typeRel(mapping, lastSon(f), a) result = typeRel(mapping, lastSon(f), a)
of tyGenericBody: of tyGenericBody:
result = typeRel(mapping, lastSon(f), a) let ff = lastSon(f)
if ff != nil: result = typeRel(mapping, ff, a)
of tyGenericInvokation: of tyGenericInvokation:
assert(f.sons[0].kind == tyGenericBody) assert(f.sons[0].kind == tyGenericBody)
if a.kind == tyGenericInvokation: if a.kind == tyGenericInvokation:

View file

@ -309,7 +309,7 @@ proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq", noSideEffect.}
## This is equivalent to ``s = @[]; setlen(s, len)``, but more ## This is equivalent to ``s = @[]; setlen(s, len)``, but more
## efficient since no reallocation is needed. ## efficient since no reallocation is needed.
proc len*[T](x: openarray[T]): int {.magic: "LengthOpenArray", noSideEffect.} proc len*[T](x: openArray[T]): int {.magic: "LengthOpenArray", noSideEffect.}
proc len*(x: string): int {.magic: "LengthStr", noSideEffect.} proc len*(x: string): int {.magic: "LengthStr", noSideEffect.}
proc len*(x: cstring): int {.magic: "LengthStr", noSideEffect.} proc len*(x: cstring): int {.magic: "LengthStr", noSideEffect.}
proc len*[I, T](x: array[I, T]): int {.magic: "LengthArray", noSideEffect.} proc len*[I, T](x: array[I, T]): int {.magic: "LengthArray", noSideEffect.}

View file

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

View file

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