mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
make tests green again
This commit is contained in:
@@ -183,7 +183,7 @@ proc eat(p: var TParser, tokType: TTokType) =
|
||||
getTok(p)
|
||||
else:
|
||||
lexMessage(p.lex, errGenerated,
|
||||
"expected " & TokTypeToStr[tokType] & ", but got: " & prettyTok(p.tok))
|
||||
"expected: '" & TokTypeToStr[tokType] & "', but got: '" & prettyTok(p.tok) & "'")
|
||||
|
||||
proc parLineInfo(p: TParser): TLineInfo =
|
||||
## Retrieve the line information associated with the parser's current state.
|
||||
|
||||
@@ -507,8 +507,8 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode =
|
||||
# number of generic type parameters:
|
||||
if safeLen(s.ast.sons[genericParamsPos]) != n.len-1:
|
||||
let expected = safeLen(s.ast.sons[genericParamsPos])
|
||||
localError(c.config, n.info, errGenerated, "cannot instantiate: " & renderTree(n) &
|
||||
"; got " & $(n.len-1) & " type(s) but expected " & $expected)
|
||||
localError(c.config, n.info, errGenerated, "cannot instantiate: '" & renderTree(n) &
|
||||
"'; got " & $(n.len-1) & " type(s) but expected " & $expected)
|
||||
return n
|
||||
result = explicitGenericSym(c, n, s)
|
||||
if result == nil: result = explicitGenericInstError(c, n)
|
||||
|
||||
@@ -74,10 +74,10 @@ iterator instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable): PSym
|
||||
# later by semAsgn in return type inference scenario
|
||||
t = q.typ
|
||||
else:
|
||||
localError(c.config, a.info, errCannotInstantiateX & s.name.s)
|
||||
localError(c.config, a.info, errCannotInstantiateX % s.name.s)
|
||||
t = errorType(c)
|
||||
elif t.kind == tyGenericParam:
|
||||
localError(c.config, a.info, errCannotInstantiateX & q.name.s)
|
||||
localError(c.config, a.info, errCannotInstantiateX % q.name.s)
|
||||
t = errorType(c)
|
||||
elif t.kind == tyGenericInvocation:
|
||||
#t = instGenericContainer(c, a, t)
|
||||
|
||||
@@ -970,7 +970,7 @@ proc trackProc*(g: ModuleGraph; s: PSym, body: PNode) =
|
||||
when false:
|
||||
listGcUnsafety(s, onlyWarning=false, g.config)
|
||||
else:
|
||||
localError(g.config, s.info, "'$1' has side effects" % s.name.s)
|
||||
localError(g.config, s.info, "'$1' can have side effects" % s.name.s)
|
||||
if not t.gcUnsafe:
|
||||
s.typ.flags.incl tfGcSafe
|
||||
if not t.hasSideEffect and sfSideEffect notin s.flags:
|
||||
|
||||
@@ -233,7 +233,7 @@ proc semCase(c: PContext, n: PNode): PNode =
|
||||
if covered == toCover(n.sons[0].typ):
|
||||
hasElse = true
|
||||
else:
|
||||
localError(c.config, n.info, "not all cases covered")
|
||||
localError(c.config, n.info, "not all cases are covered")
|
||||
closeScope(c)
|
||||
if isEmptyType(typ) or typ.kind in {tyNil, tyExpr} or not hasElse:
|
||||
for i in 1..n.len-1: discardCheck(c, n.sons[i].lastSon)
|
||||
|
||||
@@ -447,7 +447,7 @@ proc semTuple(c: PContext, n: PNode, prev: PType): PType =
|
||||
field.position = counter
|
||||
inc(counter)
|
||||
if containsOrIncl(check, field.name.id):
|
||||
localError(c.config, a.sons[j].info, "attempt to redefine: " & field.name.s)
|
||||
localError(c.config, a.sons[j].info, "attempt to redefine: '" & field.name.s & "'")
|
||||
else:
|
||||
addSon(result.n, newSymNode(field))
|
||||
addSonSkipIntLit(result, typ)
|
||||
@@ -682,7 +682,7 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int,
|
||||
f.flags = f.flags + ({sfImportc, sfExportc} * fieldOwner.flags)
|
||||
inc(pos)
|
||||
if containsOrIncl(check, f.name.id):
|
||||
localError(c.config, n.sons[i].info, "attempt to redefine: " & f.name.s)
|
||||
localError(c.config, n.sons[i].info, "attempt to redefine: '" & f.name.s & "'")
|
||||
if a.kind == nkEmpty: addSon(father, newSymNode(f))
|
||||
else: addSon(a, newSymNode(f))
|
||||
styleCheckDef(f)
|
||||
@@ -692,7 +692,7 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int,
|
||||
# inherited from generic/partial specialized parent second check.
|
||||
# There is no branch validity check here
|
||||
if containsOrIncl(check, n.sym.name.id):
|
||||
localError(c.config, n.info, "attempt to redefine: " & n.sym.name.s)
|
||||
localError(c.config, n.info, "attempt to redefine: '" & n.sym.name.s & "'")
|
||||
addSon(father, n)
|
||||
of nkEmpty: discard
|
||||
else: illFormedAst(n, c.config)
|
||||
@@ -1058,7 +1058,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
||||
inc(counter)
|
||||
if def != nil and def.kind != nkEmpty: arg.ast = copyTree(def)
|
||||
if containsOrIncl(check, arg.name.id):
|
||||
localError(c.config, a.sons[j].info, "attempt to redefine: " & arg.name.s)
|
||||
localError(c.config, a.sons[j].info, "attempt to redefine: '" & arg.name.s & "'")
|
||||
addSon(result.n, newSymNode(arg))
|
||||
rawAddSon(result, finalType)
|
||||
addParamOrResult(c, arg, kind)
|
||||
|
||||
@@ -243,7 +243,7 @@ proc lookupTypeVar(cl: var TReplTypeVars, t: PType): PType =
|
||||
result = cl.typeMap.lookup(t)
|
||||
if result == nil:
|
||||
if cl.allowMetaTypes or tfRetType in t.flags: return
|
||||
localError(cl.c.config, t.sym.info, "cannot instantiate: " & typeToString(t))
|
||||
localError(cl.c.config, t.sym.info, "cannot instantiate: '" & typeToString(t) & "'")
|
||||
result = errorType(cl.c)
|
||||
# In order to prevent endless recursions, we must remember
|
||||
# this bad lookup and replace it with errorType everywhere.
|
||||
@@ -453,7 +453,7 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
|
||||
result.kind = tyUserTypeClassInst
|
||||
|
||||
of tyGenericBody:
|
||||
localError(cl.c.config, cl.info, "cannot instantiate: " & typeToString(t))
|
||||
localError(cl.c.config, cl.info, "cannot instantiate: '" & typeToString(t) & "'")
|
||||
result = errorType(cl.c)
|
||||
#result = replaceTypeVarsT(cl, lastSon(t))
|
||||
|
||||
|
||||
@@ -2365,7 +2365,7 @@ proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo;
|
||||
var m: TCandidate
|
||||
initCandidate(c, m, dc.typ)
|
||||
if col >= dc.typ.len:
|
||||
localError(c.config, info, "cannot instantiate '" & dc.name.s & "'")
|
||||
localError(c.config, info, "cannot instantiate: '" & dc.name.s & "'")
|
||||
return nil
|
||||
var f = dc.typ.sons[col]
|
||||
|
||||
@@ -2374,7 +2374,7 @@ proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo;
|
||||
else:
|
||||
if f.kind == tyVar: f = f.lastSon
|
||||
if typeRel(m, f, t) == isNone:
|
||||
localError(c.config, info, "cannot instantiate '" & dc.name.s & "'")
|
||||
localError(c.config, info, "cannot instantiate: '" & dc.name.s & "'")
|
||||
else:
|
||||
result = c.semGenerateInstance(c, dc, m.bindings, info)
|
||||
if op == attachedDeepCopy:
|
||||
|
||||
@@ -1640,7 +1640,7 @@ proc typeMismatch*(conf: ConfigRef; info: TLineInfo, formal, actual: PType) =
|
||||
let x = if named == desc: named else: named & " = " & desc
|
||||
var msg = "type mismatch: got <" &
|
||||
typeToString(actual) & "> " &
|
||||
"but expected " & x & "'"
|
||||
"but expected '" & x & "'"
|
||||
|
||||
if formal.kind == tyProc and actual.kind == tyProc:
|
||||
case compatibleEffects(formal, actual)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
file: "tstatret.nim"
|
||||
line: 9
|
||||
errormsg: "statement not allowed after"
|
||||
errormsg: "unreachable statement after 'return'"
|
||||
"""
|
||||
# no statement after return
|
||||
proc main() =
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
discard """
|
||||
cmd: "nim check $file"
|
||||
errormsg: "The `in` modifier can be used only with imported types"
|
||||
errormsg: "the 'in' modifier can be used only with imported types"
|
||||
nimout: '''
|
||||
tinvalidinout.nim(14, 7) Error: The `out` modifier can be used only with imported types
|
||||
tinvalidinout.nim(17, 9) Error: The `in` modifier can be used only with imported types
|
||||
tinvalidinout.nim(18, 9) Error: The `in` modifier can be used only with imported types
|
||||
tinvalidinout.nim(14, 7) Error: the 'out' modifier can be used only with imported types
|
||||
tinvalidinout.nim(17, 9) Error: the 'in' modifier can be used only with imported types
|
||||
tinvalidinout.nim(18, 9) Error: the 'in' modifier can be used only with imported types
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
file: "tunderscores.nim"
|
||||
line: 8
|
||||
errormsg: "invalid token: _"
|
||||
errormsg: "invalid token: trailing underscore"
|
||||
"""
|
||||
# Bug #502670
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
errormsg: "number 0x123'u8 out of valid range"
|
||||
errormsg: "number out of range: '0x123'u8'"
|
||||
"""
|
||||
|
||||
# Bug #1179
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
line: 11
|
||||
errormsg: "identifier expected, but found 'keyword of'"
|
||||
errormsg: "identifier expected, but got 'keyword of'"
|
||||
"""
|
||||
|
||||
type
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation1.nim"
|
||||
line: 8
|
||||
column: 3
|
||||
errormsg: "':' expected"
|
||||
column: 7
|
||||
errormsg: "expected: ':', but got: 'echo'"
|
||||
"""
|
||||
try #<- missing ':'
|
||||
echo "try"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation2.nim"
|
||||
line: 11
|
||||
column: 1
|
||||
errormsg: "':' expected"
|
||||
column: 8
|
||||
errormsg: "expected: ':', but got: 'keyword finally'"
|
||||
"""
|
||||
try:
|
||||
echo "try"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation3.nim"
|
||||
line: 12
|
||||
column: 3
|
||||
errormsg: "':' expected"
|
||||
column: 7
|
||||
errormsg: "expected: ':', but got: 'echo'"
|
||||
"""
|
||||
try:
|
||||
echo "try"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
errormsg: "identifier expected, but found 'keyword when'"
|
||||
errormsg: "identifier expected, but got 'keyword when'"
|
||||
"""
|
||||
|
||||
# bug #2123
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
file: "tparameterizedparent3.nim"
|
||||
line: 13
|
||||
errormsg: "redefinition of 'color'"
|
||||
errormsg: "attempt to redefine: 'color'"
|
||||
"""
|
||||
# bug #5264
|
||||
type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
file: "tparameterizedparent4.nim"
|
||||
line: 23
|
||||
errormsg: "redefinition of 'grain'"
|
||||
errormsg: "attempt to redefine: 'grain'"
|
||||
"""
|
||||
# bug #5264
|
||||
type
|
||||
|
||||
Reference in New Issue
Block a user