diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-04-21 01:52:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 10:52:17 +0200 |
commit | 2951f89374e9797fa5567b5afd4effb3149c1fd5 (patch) | |
tree | cfaab7b6a758ce5134d957ec4e7712e43eb3cb8d /compiler/semobjconstr.nim | |
parent | f1ce173283a06197cfde80e9117ba1aa0ed0dd02 (diff) | |
download | Nim-2951f89374e9797fa5567b5afd4effb3149c1fd5.tar.gz |
improve errmsg refs #17793 object ctor with generics (#17806)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r-- | compiler/semobjconstr.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 01d5a8b28..6f3cabcbf 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -11,6 +11,8 @@ # included from sem.nim +from sugar import dup + type ObjConstrContext = object typ: PType # The constructed type @@ -389,7 +391,8 @@ 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, "object constructor needs an object type") + return localErrorNode(c, result, + "object constructor needs an object type".dup(addDeclaredLoc(c.config, t))) # Check if the object is fully initialized by recursively testing each # field (if this is a case object, initialized fields in two different |