summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semobjconstr.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index f3efc1719..77bd6b975 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -398,8 +398,12 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType
       # 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".dup(addDeclaredLoc(c.config, t)))
+    return localErrorNode(c, result, if t.kind != tyGenericBody:
+      "object constructor needs an object type".dup(addDeclaredLoc(c.config, t))
+      else: "cannot instantiate: '" &
+        typeToString(t, preferDesc) &
+        "'; the object's generic parameters cannot be inferred and must be explicitly given"
+      )
 
   # Check if the object is fully initialized by recursively testing each
   # field (if this is a case object, initialized fields in two different
hoang/Nim/commit/doc/filelist.txt?h=devel&id=d7a472743b6d3e7c0062621d0b861d20edf89663'>d7a472743 ^
439aa2d04 ^
36c67455d ^
3ea644690 ^

439aa2d04 ^




281609c35 ^

439aa2d04 ^







e792940f5 ^
439aa2d04 ^
f7884717c ^
439aa2d04 ^



f7884717c ^
3ea644690 ^
439aa2d04 ^













1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54