better error messages
This commit is contained in:
parent
4301744e49
commit
b0994c7f92
3 changed files with 17 additions and 3 deletions
|
|
@ -192,6 +192,10 @@ proc semConv(c: PContext, n: PNode): PNode =
|
|||
|
||||
result.addSon copyTree(n.sons[0])
|
||||
|
||||
# special case to make MyObject(x = 3) produce a nicer error message:
|
||||
if n[1].kind == nkExprEqExpr and
|
||||
targetType.skipTypes(abstractPtrs).kind == tyObject:
|
||||
localError(n.info, "object contruction uses ':', not '='")
|
||||
var op = semExprWithType(c, n.sons[1])
|
||||
if targetType.isMetaType:
|
||||
let final = inferWithMetatype(c, targetType, op, true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue