diff options
Diffstat (limited to 'compiler/seminst.nim')
-rw-r--r-- | compiler/seminst.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 84ae9a26f..b187f9ed8 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -253,9 +253,13 @@ proc instantiateProcType(c: PContext, pt: TypeMapping, var typeToFit = resulti let needsStaticSkipping = resulti.kind == tyFromExpr + let needsTypeDescSkipping = resulti.kind == tyTypeDesc and tfUnresolved in resulti.flags result[i] = replaceTypeVarsT(cl, resulti) if needsStaticSkipping: result[i] = result[i].skipTypes({tyStatic}) + if needsTypeDescSkipping: + result[i] = result[i].skipTypes({tyTypeDesc}) + typeToFit = result[i] # ...otherwise, we use the instantiated type in `fitNode` if (typeToFit.kind != tyTypeDesc or typeToFit.base.kind != tyNone) and @@ -292,6 +296,8 @@ proc instantiateProcType(c: PContext, pt: TypeMapping, # the user calls an explicit instantiation of the proc (this is # the only way the default value might be inserted). param.ast = errorNode(c, def) + # we know the node is empty, we need the actual type for error message + param.ast.typ = def.typ else: param.ast = fitNodePostMatch(c, typeToFit, converted) param.typ = result[i] |