diff options
Diffstat (limited to 'tests/init/tinitchecks_v2.nim')
-rw-r--r-- | tests/init/tinitchecks_v2.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/init/tinitchecks_v2.nim b/tests/init/tinitchecks_v2.nim index 4a8cda028..f7716bcca 100644 --- a/tests/init/tinitchecks_v2.nim +++ b/tests/init/tinitchecks_v2.nim @@ -57,3 +57,27 @@ proc currentlyValid(x: out int; y: out string; cond: bool) = y = "abc" # <-- error: not every path initializes 'y' currentlyValid gl, gs, false + +block: # previously effects/toutparam + proc gah[T](x: out T) = + x = 3 + + proc arr1 = + var a: array[2, int] + var x: int + gah(x) + a[0] = 3 + a[x] = 3 + echo x + + arr1() + + proc arr2 = + var a: array[2, int] + var x: int + a[0] = 3 + a[x] = 3 #[tt.Warning + ^ use explicit initialization of 'x' for clarity [Uninit] ]# + echo x + + arr2() |