diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-04-20 22:00:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 07:00:45 +0200 |
commit | 8de053d8708d3547edeee8c4846b355a557f1d18 (patch) | |
tree | d140e510ee07e160b0ddace7e5878e355b9d715d /compiler/semobjconstr.nim | |
parent | 603af22b7ca46ac566f8c7c15402028f3f976a4e (diff) | |
download | Nim-8de053d8708d3547edeee8c4846b355a557f1d18.tar.gz |
fix `hintMsgOrigin` regression + simplify msgs code (#17805)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r-- | compiler/semobjconstr.nim | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 63b4b9a75..01d5a8b28 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -210,7 +210,7 @@ proc semConstructFields(c: PContext, n: PNode, localError(c.config, constrCtx.initExpr.info, "a case selecting discriminator '$1' with value '$2' " & "appears in the object construction, but the field(s) $3 " & - "are in conflict with this value.", + "are in conflict with this value." % [discriminator.sym.name.s, discriminatorVal.renderTree, fields]) template valuesInConflictError(valsDiff) = @@ -365,11 +365,10 @@ proc defaultConstructionError(c: PContext, t: PType, info: TLineInfo) = assert constrCtx.missingFields.len > 0 localError(c.config, info, "The $1 type doesn't have a default value. The following fields must " & - "be initialized: $2.", - [typeToString(t), listSymbolNames(constrCtx.missingFields)]) + "be initialized: $2." % [typeToString(t), listSymbolNames(constrCtx.missingFields)]) elif objType.kind == tyDistinct: localError(c.config, info, - "The $1 distinct type doesn't have a default value.", [typeToString(t)]) + "The $1 distinct type doesn't have a default value." % typeToString(t)) else: assert false, "Must not enter here." @@ -379,7 +378,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = for child in n: result.add child if t == nil: - return localErrorNode(c, result, errGenerated, "object constructor needs an object type") + return localErrorNode(c, result, "object constructor needs an object type") t = skipTypes(t, {tyGenericInst, tyAlias, tySink, tyOwned}) if t.kind == tyRef: @@ -390,7 +389,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = # multiple times as long as they don't have closures. result.typ.flags.incl tfHasOwned if t.kind != tyObject: - return localErrorNode(c, result, errGenerated, "object constructor needs an object type") + return localErrorNode(c, result, "object constructor needs an object type") # Check if the object is fully initialized by recursively testing each # field (if this is a case object, initialized fields in two different @@ -404,7 +403,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = if constrCtx.missingFields.len > 0: hasError = true localError(c.config, result.info, - "The $1 type requires the following fields to be initialized: $2.", + "The $1 type requires the following fields to be initialized: $2." % [t.sym.name.s, listSymbolNames(constrCtx.missingFields)]) # Since we were traversing the object fields, it's possible that |