diff options
author | Araq <rumpf_a@web.de> | 2015-04-24 20:28:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-25 23:16:58 +0200 |
commit | 2c91e999e29208f89ab6b0995b6942b69a1e23e3 (patch) | |
tree | ad57e2df4e51328913e6c1c5d8b70d7d592784e7 /tests/overload | |
parent | ecc009093933887ab692efd5db099d752a1d2e6b (diff) | |
download | Nim-2c91e999e29208f89ab6b0995b6942b69a1e23e3.tar.gz |
fixes #2600
Diffstat (limited to 'tests/overload')
-rw-r--r-- | tests/overload/tspec.nim | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/overload/tspec.nim b/tests/overload/tspec.nim index 685df503a..99966e93e 100644 --- a/tests/overload/tspec.nim +++ b/tests/overload/tspec.nim @@ -11,7 +11,8 @@ ref T 123 2 1 -@[123, 2, 1]''' +@[123, 2, 1] +Called!''' """ # Things that's even in the spec now! @@ -79,3 +80,31 @@ proc takeV[T](a: varargs[T]) = takeV([123, 2, 1]) # takeV's T is "int", not "array of int" echo(@[123, 2, 1]) + +# bug #2600 + +type + FutureBase* = ref object of RootObj ## Untyped future. + + Future*[T] = ref object of FutureBase ## Typed future. + value: T ## Stored value + + FutureVar*[T] = distinct Future[T] + +proc newFuture*[T](): Future[T] = + new(result) + +proc newFutureVar*[T](): FutureVar[T] = + result = FutureVar[T](newFuture[T]()) + +proc mget*[T](future: FutureVar[T]): var T = + Future[T](future).value + +proc reset*[T](future: FutureVar[T]) = + echo "Called!" + +when true: + var foo = newFutureVar[string]() + foo.mget() = "" + foo.mget.add("Foobar") + foo.reset() |