diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-09-30 14:11:53 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-09-30 14:11:53 +0200 |
commit | 6d4503325cc667dcfd18c53cee6ef0d245d9f870 (patch) | |
tree | 61fd6089fe9e4ff03bce388e635777a1d0b0b1cc /tests/generics/t9130.nim | |
parent | 5676e032bda9d86232b003797bdb67070af43e28 (diff) | |
download | Nim-6d4503325cc667dcfd18c53cee6ef0d245d9f870.tar.gz |
Fix regression with runnableExamples in generic expr
The examples should not enter the generic analysis at all. The regression was introduced in 4cf704bb as a fix for #8694. Fixes #9130 Fixes #8694
Diffstat (limited to 'tests/generics/t9130.nim')
-rw-r--r-- | tests/generics/t9130.nim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/generics/t9130.nim b/tests/generics/t9130.nim new file mode 100644 index 000000000..a993bc6b2 --- /dev/null +++ b/tests/generics/t9130.nim @@ -0,0 +1,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) |