diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/astalgo.nim | 9 | ||||
-rw-r--r-- | compiler/seminst.nim | 7 | ||||
-rw-r--r-- | compiler/semtypes.nim | 3 |
3 files changed, 16 insertions, 3 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 0afe56bb7..a4a14405e 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -31,6 +31,15 @@ when declared(echo): proc debug*(conf: ConfigRef; n: PType) {.deprecated.} proc debug*(conf: ConfigRef; n: PNode) {.deprecated.} + template debug*(x: PSym|PType|PNode) {.deprecated.} = + when compiles(c.config): + debug(c.config, x) + else: + error() + + template debug*(x: auto) {.deprecated.} = + echo x + template mdbg*: bool {.dirty.} = when compiles(c.module): c.module.fileIdx == c.config.projectMainIdx diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 0047fd68e..0ad1fb872 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -248,8 +248,8 @@ proc instantiateProcType(c: PContext, pt: TIdTable, resetIdTable(cl.symMap) resetIdTable(cl.localCache) - # take a note of the original type. If't a free type parameter - # we'll need to keep it unbount for the `fitNode` operation below... + # take a note of the original type. If't a free type or static parameter + # we'll need to keep it unbound for the `fitNode` operation below... var typeToFit = result[i] let needsStaticSkipping = result[i].kind == tyFromExpr @@ -258,7 +258,8 @@ proc instantiateProcType(c: PContext, pt: TIdTable, result[i] = result[i].skipTypes({tyStatic}) # ...otherwise, we use the instantiated type in `fitNode` - if typeToFit.kind != tyTypeDesc or typeToFit.base.kind != tyNone: + if (typeToFit.kind != tyTypeDesc or typeToFit.base.kind != tyNone) and + (typeToFit.kind != tyStatic): typeToFit = result[i] internalAssert c.config, originalParams[i].kind == nkSym diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index f60b57d33..ff2820ec8 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1056,6 +1056,9 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, if not containsGenericType(typ): # check type compatibility between def.typ and typ: def = fitNode(c, typ, def, def.info) + elif typ.kind == tyStatic: + def = semConstExpr(c, def) + def = fitNode(c, typ, def, def.info) if not hasType and not hasDefault: if isType: localError(c.config, a.info, "':' expected") |