summary refs log tree commit diff stats
path: root/tests/generics/t9130.nim
blob: a993bc6b23c1f7cb0ae932fca88287098b21d995 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
when true:
  # stack overflow
  template baz1*(iter: untyped): untyped =
    runnableExamples:
      import sugar
      proc fun(a: proc(x:int): int) = discard
      baz1(fun(x:int => x))
    discard

  proc foo1[A](ts: A) =
    baz1(ts)

when true:
  # ok
  template baz2*(iter: untyped): untyped =
    runnableExamples:
      import sugar
      proc fun(a: proc(x:int): int) = discard
      baz2(fun(x:int => x))
    discard

  proc foo2(ts: int) =
    baz2(ts)

when true:
  # stack overflow
  template baz3*(iter: untyped): untyped =
    runnableExamples:
      baz3(fun(x:int => x))
    discard

  proc foo3[A](ts: A) =
    baz3(ts)