summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-04-07 23:18:14 +0300
committerZahary Karadjov <zahary@gmail.com>2017-04-08 17:28:19 +0300
commite9a3ffbc3d318911da5c46582a70288dd16275f3 (patch)
tree8b9f8c8b1cc9afc25cb7d0a9b218ea7ee4f6bcdd /compiler/vm.nim
parentfceef773015bd7f764c51549ec20768b5e9f5eb1 (diff)
downloadNim-e9a3ffbc3d318911da5c46582a70288dd16275f3.tar.gz
Restore the Nim's 0.14 proper handling of generic aliases
A more efficient implementation is possible by restoring the old
lifting ot tyGenericInvocation to tyGenericInst in liftTypeParam,
but this fix will suffice for now.

fixes #5087
fixes #5602
fixes #5641
fixes #5570
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 6a9545193..14800fb13 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1606,6 +1606,12 @@ proc setupMacroParam(x: PNode, typ: PType): TFullReg =
     n.typ = x.typ
     result.node = n
 
+iterator genericParamsInMacroCall*(macroSym: PSym, call: PNode): (PSym, PNode) =
+  let gp = macroSym.ast[genericParamsPos]
+  for i in 0 .. <gp.len:
+    let idx = macroSym.typ.len + i
+    yield (gp[i].sym, call.sons[idx])
+
 var evalMacroCounter: int
 
 proc evalMacroCall*(module: PSym; cache: IdentCache, n, nOrig: PNode,