From 45d1e55e72aea9acfcf1a6fb7061779a243d7921 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Fri, 19 Jun 2020 14:56:38 +0200 Subject: [PATCH] Add testcases for #11811 and #14315 (#14726) * Add testcase for #11811 * Add testcase for #14315 --- tests/bind/tbind.nim | 11 +++++++++++ tests/destructor/tdestructor.nim | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/bind/tbind.nim b/tests/bind/tbind.nim index 49c37ae2e0..f3fb952e31 100644 --- a/tests/bind/tbind.nim +++ b/tests/bind/tbind.nim @@ -4,6 +4,7 @@ output: ''' 1 1 1 +5 ''' """ @@ -65,3 +66,13 @@ block tmixin: Foo(a) Foo(b) + +# issue #11811 +proc p(a : int) = + echo a + +proc printVar*[T:int|float|string](a : T) = + bind p + p(a) + +printVar(5) diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim index b6d60323c4..9fd47fe001 100644 --- a/tests/destructor/tdestructor.nim +++ b/tests/destructor/tdestructor.nim @@ -154,4 +154,14 @@ proc caseobj_test_sink: TCaseObj = echo "---" -discard caseobj_test_sink() \ No newline at end of file +discard caseobj_test_sink() + +# issue #14315 + +type Vector*[T] = object + x1: int + # x2: T # uncomment will remove error + +# proc `=destroy`*(x: var Vector[int]) = discard # this will remove error +proc `=destroy`*[T](x: var Vector[T]) = discard +var a: Vector[int] # Error: unresolved generic parameter