diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 1e4bb90ebca93..b2dfc36b16a5d 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -79,7 +79,7 @@ proc semConstrField(c: PContext, flags: TExprFlags, if nfSkipFieldChecking in assignment[1].flags: discard elif not fieldVisible(c, field): - localError(c.config, initExpr.info, + localError(c.config, assignment[0].info, "the field '$1' is not accessible." % [field.name.s]) return @@ -521,7 +521,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType for j in 1..