diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-05-16 10:03:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-16 10:03:22 -0700 |
commit | 3619a5a2aa1c7387ec7df01b195bc683943654ff (patch) | |
tree | 3c36ca5452ad58407b89c8244211bbe4f3608adf /compiler/semobjconstr.nim | |
parent | 65f6b6682027d030279d9aa5b0b6f9bbc3cf5123 (diff) | |
download | Nim-3619a5a2aa1c7387ec7df01b195bc683943654ff.tar.gz |
more informative error msg for undeclared field (`A(badfield: 1)` and `a.badfield = expr`) (#17777)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r-- | compiler/semobjconstr.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 6f3cabcbf..16e3c6cee 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -429,7 +429,8 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = hasError = true break # 2) No such field exists in the constructed type - localError(c.config, field.info, errUndeclaredFieldX % id.s) + let msg = errUndeclaredField % id.s & " for type " & getProcHeader(c.config, t.sym) + localError(c.config, field.info, msg) hasError = true break |