diff options
-rw-r--r-- | compiler/semstmts.nim | 2 | ||||
-rw-r--r-- | tests/generics/t3977.nim | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 3687e50e9..7213601de 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -498,7 +498,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = def = fitNode(c, typ, def, def.info) #changeType(def.skipConv, typ, check=true) else: - typ = skipIntLit(def.typ) + typ = def.typ.skipTypes({tyStatic}).skipIntLit if typ.kind in tyUserTypeClasses and typ.isResolvedUserTypeClass: typ = typ.lastSon if hasEmpty(typ): diff --git a/tests/generics/t3977.nim b/tests/generics/t3977.nim new file mode 100644 index 000000000..314017744 --- /dev/null +++ b/tests/generics/t3977.nim @@ -0,0 +1,12 @@ +discard """ + output: '''42''' +""" + +type + Foo[N: static[int]] = object + +proc foo[N](x: Foo[N]) = + echo N + +var f1: Foo[42] +f1.foo |