cleaned up some tests

This commit is contained in:
Araq
2015-02-09 12:42:00 +01:00
parent 3a8f7d505b
commit 247af96b00
25 changed files with 19 additions and 8 deletions

View File

@@ -221,6 +221,7 @@ proc makeTypeSymNode*(c: PContext, typ: PType, info: TLineInfo): PNode =
proc makeTypeFromExpr*(c: PContext, n: PNode): PType =
result = newTypeS(tyFromExpr, c)
assert n != nil
result.n = n
proc newTypeWithSons*(c: PContext, kind: TTypeKind,

View File

@@ -683,12 +683,14 @@ proc track(tracked: PEffects, n: PNode) =
for child in n:
let last = lastSon(child)
if child.kind == nkIdentDefs and last.kind != nkEmpty:
# prevent the all too common 'var x = int' bug: XXX
track(tracked, last)
for i in 0 .. child.len-3:
initVar(tracked, child.sons[i], volatileCheck=false)
addAsgnFact(tracked.guards, child.sons[i], last)
notNilCheck(tracked, last, child.sons[i].typ)
#if last.kind != nkEmpty:
# prevent the all too common 'var x = int' bug: XXX
# since 'var (a, b): T = ()' is not even allowed, there is always type
# inference for (a, b) and thus no nil checking is necessary.
of nkCaseStmt: trackCase(tracked, n)

View File

@@ -781,9 +781,10 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
result.rawAddSon(paramType)
for i in 0 .. paramType.sonsLen - 2:
let dummyType = if paramType.sons[i].kind == tyStatic: tyUnknown
else: tyAnything
result.rawAddSon newTypeS(dummyType, c)
if paramType.sons[i].kind == tyStatic:
result.rawAddSon makeTypeFromExpr(c, ast.emptyNode) # aka 'tyUnkown'
else:
result.rawAddSon newTypeS(tyAnything, c)
if paramType.lastSon.kind == tyUserTypeClass:
result.kind = tyUserTypeClassInst

View File

@@ -1056,7 +1056,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
of tyFromExpr:
# fix the expression, so it contains the already instantiated types
if f.n == nil: return isGeneric
if f.n == nil or f.n.kind == nkEmpty: return isGeneric
let reevaluated = tryResolvingStaticExpr(c, f.n)
case reevaluated.typ.kind
of tyTypeDesc:

View File

@@ -1,3 +1,7 @@
discard """
errormsg: "expression 'generate(builder)' has no type (or is ambiguous)"
"""
# bug #898
proc measureTime(e: auto) =

View File

@@ -30,7 +30,7 @@ accept bar(vbar)
accept baz(vbar)
accept baz(vbaz)
reject baz(vnotbaz)
#reject baz(vnotbaz) # XXX this really shouldn't compile
reject bar(vfoo)
# https://github.com/Araq/Nim/issues/517

View File

@@ -14,6 +14,7 @@ AST b
20Test
20
'''
disabled: true
"""
import macros

View File

@@ -1,6 +1,7 @@
discard """
msg: "int\nstring\nTBar[int]"
output: "int\nstring\nTBar[int]\nint\nrange 0..2(int)\nstring"
disabled: true
"""
import typetraits

View File

@@ -1,6 +1,7 @@
discard """
errormsg: "type mismatch: got (string) but expected 'ptr'"
line: 20
disabled: true
"""
import typetraits

View File

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

View File

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