* Fix for issue #10342. better message for generic subclass instantiation errors.
This commit is contained in:
parent
a0c07ef863
commit
94f6a6b294
4 changed files with 33 additions and 4 deletions
|
|
@ -490,7 +490,12 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
|
|||
result.kind = tyUserTypeClassInst
|
||||
|
||||
of tyGenericBody:
|
||||
localError(cl.c.config, cl.info, "cannot instantiate: '" & typeToString(t) & "'")
|
||||
localError(
|
||||
cl.c.config,
|
||||
cl.info,
|
||||
"cannot instantiate: '" &
|
||||
typeToString(t, preferDesc) &
|
||||
"'; Maybe generic arguments are missing?")
|
||||
result = errorType(cl.c)
|
||||
#result = replaceTypeVarsT(cl, lastSon(t))
|
||||
|
||||
|
|
@ -555,6 +560,14 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
|
|||
|
||||
for i in countup(0, sonsLen(result) - 1):
|
||||
if result.sons[i] != nil:
|
||||
if result.sons[i].kind == tyGenericBody:
|
||||
localError(
|
||||
cl.c.config,
|
||||
t.sym.info,
|
||||
"cannot instantiate '" &
|
||||
typeToString(result.sons[i], preferDesc) &
|
||||
"' inside of type definition: '" &
|
||||
t.owner.name.s & "'; Maybe generic arguments are missing?")
|
||||
var r = replaceTypeVarsT(cl, result.sons[i])
|
||||
if result.kind == tyObject:
|
||||
# carefully coded to not skip the precious tyGenericInst:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue