summary refs log tree commit diff stats
path: root/compiler/semcall.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-08-05 14:17:24 +0200
committerAraq <rumpf_a@web.de>2018-08-05 14:17:24 +0200
commit7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a (patch)
tree2e79c210ccd19a7065b36992e19ab74ff061f5df /compiler/semcall.nim
parent282c4f3d0a72fbb4c49df51048e2e13fafcd8659 (diff)
parent74842ed4a981b6ff168d67d05ee92dce350549cb (diff)
downloadNim-7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a.tar.gz
make at least bootstrapping work
Diffstat (limited to 'compiler/semcall.nim')
-rw-r--r--compiler/semcall.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index 67fe99232..aa5394a71 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -505,7 +505,15 @@ proc explicitGenericSym(c: PContext, n: PNode, s: PSym): PNode =
 
   for i in 1..sonsLen(n)-1:
     let formal = s.ast.sons[genericParamsPos].sons[i-1].typ
-    let arg = n[i].typ
+    var arg = n[i].typ
+    # try transforming the argument into a static one before feeding it into
+    # typeRel
+    if formal.kind == tyStatic and arg.kind != tyStatic:
+      let evaluated = c.semTryConstExpr(c, n[i])
+      if evaluated != nil:
+        arg = newTypeS(tyStatic, c)
+        arg.sons = @[evaluated.typ]
+        arg.n = evaluated
     let tm = typeRel(m, formal, arg)
     if tm in {isNone, isConvertible}: return nil
   var newInst = generateInstance(c, s, m.bindings, n.info)