make tests green again

This commit is contained in:
Araq 2018-05-14 21:38:18 +02:00
commit 02b78d3f94
20 changed files with 33 additions and 33 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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)

View file

@ -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:

View file

@ -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)

View file

@ -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)

View file

@ -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))

View file

@ -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:

View file

@ -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)