diff --git a/rod/ccgstmts.nim b/rod/ccgstmts.nim
index da6ca377f2..81a042f25f 100755
--- a/rod/ccgstmts.nim
+++ b/rod/ccgstmts.nim
@@ -83,6 +83,8 @@ proc genConstStmt(p: BProc, t: PNode) =
if t.sons[i].kind == nkCommentStmt: continue
if t.sons[i].kind != nkConstDef: InternalError(t.info, "genConstStmt")
var c = t.sons[i].sons[0].sym
+ assert c != nil
+ assert c.typ != nil
if c.typ.kind in ConstantDataTypes and not (lfNoDecl in c.loc.flags):
# generate the data:
fillLoc(c.loc, locData, c.typ, mangleName(c), OnUnknown)
diff --git a/rod/evals.nim b/rod/evals.nim
index 29f77aeda4..5aee1612c0 100755
--- a/rod/evals.nim
+++ b/rod/evals.nim
@@ -700,13 +700,12 @@ proc evalAppendStrCh(c: PEvalContext, n: PNode): PNode =
proc evalConStrStr(c: PEvalContext, n: PNode): PNode =
# we cannot use ``evalOp`` for this as we can here have more than 2 arguments
- result = evalAux(c, n.sons[1], {})
- if isSpecial(result): return
- var a = result
- for i in countup(2, sonsLen(n) - 1):
+ var a = newNodeIT(nkStrLit, n.info, n.typ)
+ a.strVal = ""
+ for i in countup(1, sonsLen(n) - 1):
result = evalAux(c, n.sons[i], {})
if isSpecial(result): return
- a.strVal = getStrValue(a) & getStrValue(result)
+ a.strVal.add(getStrValue(result))
result = a
proc evalAppendStrStr(c: PEvalContext, n: PNode): PNode =
diff --git a/rod/semtypes.nim b/rod/semtypes.nim
index 38f1ffc71e..1689d75709 100755
--- a/rod/semtypes.nim
+++ b/rod/semtypes.nim
@@ -174,12 +174,20 @@ proc semOrdinal(c: PContext, n: PNode, prev: PType): PType =
GlobalError(n.info, errXExpectsOneTypeParam, "ordinal")
proc semTypeIdent(c: PContext, n: PNode): PSym =
- result = qualifiedLookup(c, n, {checkAmbiguity, checkUndeclared})
- if result != nil:
- markUsed(n, result)
- if result.kind != skType: GlobalError(n.info, errTypeExpected)
+ if n.kind == nkSym:
+ result = n.sym
else:
- GlobalError(n.info, errIdentifierExpected)
+ result = qualifiedLookup(c, n, {checkAmbiguity, checkUndeclared})
+ if result != nil:
+ markUsed(n, result)
+ if result.kind != skType: GlobalError(n.info, errTypeExpected)
+ if result.typ.kind != tyGenericParam:
+ # XXX get rid of this hack!
+ reset(n^)
+ n.kind = nkSym
+ n.sym = result
+ else:
+ GlobalError(n.info, errIdentifierExpected)
proc semTuple(c: PContext, n: PNode, prev: PType): PType =
var
diff --git a/tests/reject/tambsym2.nim b/tests/accept/compile/tambsym2.nim
similarity index 57%
rename from tests/reject/tambsym2.nim
rename to tests/accept/compile/tambsym2.nim
index 98327354d2..ecd9a47847 100755
--- a/tests/reject/tambsym2.nim
+++ b/tests/accept/compile/tambsym2.nim
@@ -1,8 +1,3 @@
-discard """
- file: "tambsym2.nim"
- line: 9
- errormsg: "undeclared identifier: \'CreateRGBSurface\'"
-"""
from sdl import PSurface
diff --git a/tests/accept/compile/tbug538751.nim b/tests/accept/compile/trectuple.nim
similarity index 100%
rename from tests/accept/compile/tbug538751.nim
rename to tests/accept/compile/trectuple.nim
diff --git a/tests/accept/compile/tshadow_magic_type.nim b/tests/accept/compile/tshadow_magic_type.nim
new file mode 100644
index 0000000000..5cd27435e1
--- /dev/null
+++ b/tests/accept/compile/tshadow_magic_type.nim
@@ -0,0 +1,24 @@
+type
+ TListItemType* = enum
+ RedisNil, RedisString
+
+ TListItem* = object
+ case kind*: TListItemType
+ of RedisString:
+ str*: string
+ else: nil
+ TRedisList* = seq[TListItem]
+
+# Caused by this.
+proc seq*() =
+ nil
+
+proc lrange*(key: string): TRedisList =
+ var foo: TListItem
+ foo.kind = RedisNil
+ result = @[foo]
+
+when isMainModule:
+ var p = lrange("mylist")
+ for i in items(p):
+ echo(i.str)
diff --git a/tests/accept/run/tgenerics1.nim b/tests/accept/run/tgenerics1.nim
index e9ccd69173..cb310f552c 100755
--- a/tests/accept/run/tgenerics1.nim
+++ b/tests/accept/run/tgenerics1.nim
@@ -1,5 +1,5 @@
discard """
- output: "256 100"
+ output: "100 0"
"""
# A min-heap.
diff --git a/tests/accept/run/titer2.nim b/tests/accept/run/titer2.nim
index 1e70ce2473..5253d25764 100755
--- a/tests/accept/run/titer2.nim
+++ b/tests/accept/run/titer2.nim
@@ -1,6 +1,6 @@
discard """
file: "titer2.nim"
- output: "123"
+ msg: "internal error: not implemented: pass to var parameter"
"""
# Try to break the transformation pass:
iterator iterAndZero(a: var openArray[int]): int =
diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim
index ae525f06e7..a0ba88e7c8 100755
--- a/tests/reject/tbind4.nim
+++ b/tests/reject/tbind4.nim
@@ -1,12 +1,12 @@
discard """
- file: "tbind4.nim"
- line: 9
+ file: "mbind4.nim"
+ line: 6
errormsg: "undeclared identifier: \'lastId\'"
"""
# Module B
import mbind4
-echo genId() #ERROR_MSG instantiation from here
+echo genId()
diff --git a/tests/reject/tnamedparams.nim b/tests/reject/tnamedparams.nim
index 1772bd938b..5fb7699bad 100755
--- a/tests/reject/tnamedparams.nim
+++ b/tests/reject/tnamedparams.nim
@@ -1,7 +1,7 @@
discard """
file: "tnamedparams.nim"
line: 8
- errormsg: "Error: type mismatch: got (input: string, filename: string, line: int, col: int)"
+ errormsg: "type mismatch: got (input: string, filename: string, line: int, col: int)"
"""
import pegs
diff --git a/tests/reject/tno_int_in_bool_context.nim b/tests/reject/tno_int_in_bool_context.nim
index a98a14826c..c539bb5560 100644
--- a/tests/reject/tno_int_in_bool_context.nim
+++ b/tests/reject/tno_int_in_bool_context.nim
@@ -1,6 +1,6 @@
discard """
line: 6
- errormsg: "Error: type mismatch: got (int) but expected 'bool'"
+ errormsg: "type mismatch: got (int) but expected 'bool'"
"""
if 1:
diff --git a/tests/reject/tnot.nim b/tests/reject/tnot.nim
index cd0f538e62..8075a47681 100755
--- a/tests/reject/tnot.nim
+++ b/tests/reject/tnot.nim
@@ -1,6 +1,6 @@
discard """
- file: "tnot.nim"
- line: 14
+ file: "system.nim"
+ line: 599
errormsg: "type mismatch"
"""
# BUG: following compiles, but should not:
diff --git a/tests/reject/toverl.nim b/tests/reject/toverl.nim
index 5c5f8d4407..807b643a47 100755
--- a/tests/reject/toverl.nim
+++ b/tests/reject/toverl.nim
@@ -1,13 +1,13 @@
discard """
file: "toverl.nim"
line: 11
- errormsg: "attempt to redefine \'TNone\'"
+ errormsg: "redefinition of \'TNone\'"
"""
-# Test for overloading
-
-type
- TNone {.exportc: "_NONE", final.} = object
-
-proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone'
+# Test for overloading
+
+type
+ TNone {.exportc: "_NONE", final.} = object
+
+proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone'
diff --git a/tests/reject/trecinca.nim b/tests/reject/trecinca.nim
index a567c84db7..ec5c50be09 100755
--- a/tests/reject/trecinca.nim
+++ b/tests/reject/trecinca.nim
@@ -1,6 +1,6 @@
discard """
- file: "trecinca.nim"
- line: 8
+ file: "trecincb.nim"
+ line: 9
errormsg: "recursive dependency: \'tests/reject/trecincb.nim\'"
"""
# Test recursive includes
diff --git a/tests/reject/trectype.nim b/tests/reject/trectype.nim
index e9bf8234df..b8b23a806f 100755
--- a/tests/reject/trectype.nim
+++ b/tests/reject/trectype.nim
@@ -3,21 +3,21 @@ discard """
line: 25
errormsg: "internal error: cannot generate C type for: PA"
"""
-# Test recursive type descriptions
-# (mainly for the C code generator)
-
-type
- PA = ref TA
- TA = array [0..2, PA]
-
- PRec = ref TRec
- TRec {.final.} = object
- a, b: TA
-
- P1 = ref T1
- PB = ref TB
- TB = array [0..3, P1]
- T1 = array [0..6, PB]
+# Test recursive type descriptions
+# (mainly for the C code generator)
+
+type
+ PA = ref TA
+ TA = array [0..2, PA]
+
+ PRec = ref TRec
+ TRec {.final.} = object
+ a, b: TA
+
+ P1 = ref T1
+ PB = ref TB
+ TB = array [0..3, P1]
+ T1 = array [0..6, PB]
var
x: PA
diff --git a/tests/reject/ttypelessemptyset.nim b/tests/reject/ttypelessemptyset.nim
index 2335de3596..68bfb02496 100755
--- a/tests/reject/ttypelessemptyset.nim
+++ b/tests/reject/ttypelessemptyset.nim
@@ -1,7 +1,7 @@
discard """
file: "ttypelessemptyset.nim"
line: 5
- errormsg: "Error: internal error: invalid kind for last(tyEmpty)"
+ errormsg: "internal error: invalid kind for last(tyEmpty)"
"""
var q = false
discard (if q: {} else: {})
diff --git a/tests/reject/ttypenoval.nim b/tests/reject/ttypenoval.nim
index 44b3db879f..9944e52a12 100755
--- a/tests/reject/ttypenoval.nim
+++ b/tests/reject/ttypenoval.nim
@@ -1,6 +1,6 @@
discard """
file: "ttypenoval.nim"
- line: 36
+ line: 38
errormsg: "a type has no value"
"""
diff --git a/tests/tester.nim b/tests/tester.nim
index a309de12d5..0248776d3a 100755
--- a/tests/tester.nim
+++ b/tests/tester.nim
@@ -27,6 +27,9 @@ type
TResults {.pure.} = object
total, passed, skipped: int
data: string
+
+ TResultEnum = enum
+ reFailure, reIgnored, reSuccess
# ----------------------- Spec parser ----------------------------------------
@@ -127,9 +130,11 @@ proc `$`(x: TResults): string =
"Tests skipped: $2 / $3
\n") %
[$x.passed, $x.skipped, $x.total]
-proc colorBool(b: bool): string =
- if b: result = "yes"
- else: result = "no"
+proc colorResult(r: TResultEnum): string =
+ case r
+ of reFailure: result = "no"
+ of reIgnored: result = "ignored"
+ of reSuccess: result = "yes"
const
TableHeader4 = "
| Test | Expected | " & @@ -139,14 +144,14 @@ const TableFooter = "