diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index b2dfc36b16..9a87a85669 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -236,7 +236,7 @@ proc semConstructFields(c: PContext, n: PNode, constrCtx: var ObjConstrContext, let prevFields = fieldsPresentInBranch(selectedBranch) let currentFields = fieldsPresentInBranch(i) localError(c.config, constrCtx.initExpr.info, - ("The fields '$1' and '$2' cannot be initialized together, " & + ("The fields $1 and $2 cannot be initialized together, " & "because they are from conflicting branches in the case object.") % [prevFields, currentFields]) result.status = initConflict diff --git a/tests/errmsgs/tconflictingfields.nim b/tests/errmsgs/tconflictingfields.nim new file mode 100644 index 0000000000..bb8705dcd4 --- /dev/null +++ b/tests/errmsgs/tconflictingfields.nim @@ -0,0 +1,16 @@ +discard """ + errormsg: ''' +The fields 'x' and 'y' cannot be initialized together, because they are from conflicting branches in the case object. +''' +""" + +type + Foo = object + case kind: bool + of true: + x: int + of false: + y: int + + +var f = Foo(x: 1, y: 1) \ No newline at end of file