From ecdf550c86f05b9c192e9a08ccf67682fafd27b6 Mon Sep 17 00:00:00 2001 From: Jonathan Worthington Date: Wed, 5 Feb 2020 16:10:44 +0100 Subject: [PATCH] Add a test for using shaped parameter variables Covers https://github.com/rakudo/rakudo/issues/3314. --- S06-signature/shape.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/S06-signature/shape.t b/S06-signature/shape.t index 933b7bdeac..8d284e018e 100644 --- a/S06-signature/shape.t +++ b/S06-signature/shape.t @@ -1,7 +1,7 @@ use v6; use Test; -plan 35; +plan 36; sub single-dim(@a[3]) { } lives-ok { single-dim(Array.new(:shape(3))) }, '[3] shape constraint accepts matcing array'; @@ -50,3 +50,7 @@ dies-ok { dependent(4, Array.new()) }, 'can use earlier parameters in shape spec dies-ok { dependent(4, Array.new(:shape(4,3))) }, 'can use earlier parameters in shape specification (5)'; is-deeply (my @a[Bool]).shape, (2,), "can have an Enum as a shape definition"; + +# https://github.com/rakudo/rakudo/issues/3314 +is (-> @a[3] { @a[1] })(my @b[3] = ), 'b', + 'Shape-constrained array in signature declares a variable that we can access';