diff options
author | Zahary Karadjov <zahary@gmail.com> | 2018-04-22 17:26:10 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2018-06-16 16:46:32 +0300 |
commit | 509d6e923284f1f02c5dbc64e43aee9df1a012d3 (patch) | |
tree | 79966ea543fd578fac9865c83f84011c9ea38b6d | |
parent | fb27357b6217f53dc882e83fc128da578ad51764 (diff) | |
download | Nim-509d6e923284f1f02c5dbc64e43aee9df1a012d3.tar.gz |
Bugfix: aliases to generic types were not considered implicit generic parameters
-rw-r--r-- | compiler/semtypes.nim | 3 | ||||
-rw-r--r-- | tests/statictypes/tstatictypes.nim | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 597522f6f..19bb53209 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 000000000..a646b61f7 --- /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 + |