From 509d6e923284f1f02c5dbc64e43aee9df1a012d3 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 22 Apr 2018 17:26:10 +0300 Subject: [PATCH] Bugfix: aliases to generic types were not considered implicit generic parameters --- compiler/semtypes.nim | 3 +++ tests/statictypes/tstatictypes.nim | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/statictypes/tstatictypes.nim diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 597522f6fe..19bb53209a 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -887,6 +887,9 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, # disable the bindOnce behavior for the type class result = liftingWalk(paramType.base, true) + of tyAlias: + result = liftingWalk(paramType.base) + of tySequence, tySet, tyArray, tyOpenArray, tyVar, tyLent, tyPtr, tyRef, tyProc: # XXX: this is a bit strange, but proc(s: seq) diff --git a/tests/statictypes/tstatictypes.nim b/tests/statictypes/tstatictypes.nim new file mode 100644 index 0000000000..a646b61f7f --- /dev/null +++ b/tests/statictypes/tstatictypes.nim @@ -0,0 +1,17 @@ +discard """ +nimout: ''' +staticAlialProc instantiated with 4 +staticAlialProc instantiated with 6 +''' +""" + +type + StaticTypeAlias = static[int] + +proc staticAliasProc(s: StaticTypeAlias) = + static: echo "staticAlialProc instantiated with ", s + 1 + +staticAliasProc 1+2 +staticAliasProc 3 +staticAliasProc 5 +