parent
f4f21c89e5
commit
086efac49b
2 changed files with 26 additions and 1 deletions
|
|
@ -955,8 +955,17 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
hasErrorType = true
|
hasErrorType = true
|
||||||
break
|
break
|
||||||
if not hasErrorType:
|
if not hasErrorType:
|
||||||
|
let typ = n[0].typ
|
||||||
msg.add(">\nbut expected one of: \n" &
|
msg.add(">\nbut expected one of: \n" &
|
||||||
typeToString(n[0].typ))
|
typeToString(typ))
|
||||||
|
# prefer notin preferToResolveSymbols
|
||||||
|
# t.sym != nil
|
||||||
|
# sfAnon notin t.sym.flags
|
||||||
|
# t.kind != tySequence(It is tyProc)
|
||||||
|
if typ.sym != nil and sfAnon notin typ.sym.flags and
|
||||||
|
typ.kind == tyProc:
|
||||||
|
msg.add(" = " &
|
||||||
|
typeToString(typ, preferDesc))
|
||||||
localError(c.config, n.info, msg)
|
localError(c.config, n.info, msg)
|
||||||
return errorNode(c, n)
|
return errorNode(c, n)
|
||||||
result = nil
|
result = nil
|
||||||
|
|
|
||||||
16
tests/errmsgs/t6608.nim
Normal file
16
tests/errmsgs/t6608.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
discard """
|
||||||
|
cmd: "nim c --hints:off $file"
|
||||||
|
errormsg: "type mismatch: got <>"
|
||||||
|
nimout: '''t6608.nim(14, 4) Error: type mismatch: got <>
|
||||||
|
but expected one of:
|
||||||
|
AcceptCB = proc (s: string){.closure.}'''
|
||||||
|
line: 14
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
AcceptCB = proc (s: string)
|
||||||
|
|
||||||
|
proc x(x: AcceptCB) =
|
||||||
|
x()
|
||||||
|
|
||||||
|
x()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue