no generic parameters allowed for ref #4395

Closed
yglukhov opened this Issue Jun 22, 2016 · 1 comment

Projects

None yet

1 participant

@yglukhov
Member

Don't know how to describe this issue correctly.

import macros
import typetraits

template foo(t: typedesc) =
  echo t.name

macro myMacro(p: typed): stmt =
  result = newNimNode(nnkStmtList)
  let t = getType(p)
  for i in 2 ..< t.len:
    result.add(newCall("foo", newCall("type", (t[i]))))

type O = ref int # Replace with "type O = int" to make it work

proc test(i: cint, p: proc(a: O)) =
  myMacro(p)
test.nim(16, 10) template/generic instantiation from here
test.nim(9, 18) Error: no generic parameters allowed for ref
@Araq Araq closed this in 5f4e98b Jun 23, 2016
@yglukhov
Member

@Araq, thanks for the fix! It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment