Permalink
Browse files

@foo requires Positional, %foo requires Associative (fixes #50)

  • Loading branch information...
1 parent c6b4acc commit c8eeefc0cf9e6a01c3c292edcb077d24247bc61d @sorear committed Jan 5, 2012
Showing with 11 additions and 2 deletions.
  1. +4 −0 lib/Kernel.cs
  2. +2 −2 test.pl
  3. +5 −0 test3.pl
View
@@ -2522,6 +2522,10 @@ public class Frame: P6any, IFixup {
obj_src = -1;
goto get_default;
}
+ if ((flags & Parameter.IS_LIST) != 0)
+ type = Kernel.PositionalMO;
+ if ((flags & Parameter.IS_HASH) != 0)
+ type = Kernel.AssociativeMO;
if (!srco.Does(type)) {
if (quiet) goto quiet_fail;
if (srco.mo.HasType(Kernel.JunctionMO) && obj_src != -1) {
View
@@ -825,9 +825,9 @@
rxtest /\S/, '\S', ("x", "1", "+"),
(" ", ("\n" => '\n'), ("\r" => '\r'), ("\x3000" => 'id space'));
rxtest /\w/, '\w', ("x", "1", "_", "\x4E00"), ("+", " ");
-rxtest /<[ y ]>/, '<[ y ]>', ("y"), (" ", "x", "z");
+rxtest /<[ y ]>/, '<[ y ]>', ("y",), (" ", "x", "z");
rxtest /<[ i .. k ]>/, '<[ i .. k ]>', ("i", "j", "k"), ("h", "l");
-rxtest /<[ \W a..z ]>/, '<[\W a..z]>', ("a", "z", "+"), ("\x4E00");
+rxtest /<[ \W a..z ]>/, '<[\W a..z]>', ("a", "z", "+"), ("\x4E00",);
rxtest /a || b/, 'a || b', ("a", "b"), ("c", "");
rxtest /x [a || aa]: c/, 'x[a||b]:c', ("xac",), ("xaac",);
View
@@ -80,3 +80,8 @@
is qux(Int), 'U', 'multi can discriminate on :U/:D (1)';
is qux(5), 'D', 'multi can discriminate on :U/:D (2)';
}
+
+{
+ sub foo(%x) { } #OK
+ dies_ok { foo(3) }, '%x needs Associative';
+}

0 comments on commit c8eeefc

Please sign in to comment.