Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement validation for "is rw"
  • Loading branch information
sorear committed May 16, 2011
1 parent a2b2f37 commit 622e5dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Kernel.cs
Expand Up @@ -409,8 +409,7 @@ public class SubInfo {

// XXX $_ stupidity
if (rw && !src.rw)
rw = false;
//return Kernel.Die(th, "Binding " + PName(rbase) + ", cannot bind read-only value to is rw parameter");
return Kernel.Die(th, "Binding " + PName(rbase) + ", cannot bind read-only value to is rw parameter");
// fast path
if (rw == src.rw && islist == src.islist) {
if (!src.type.HasMRO(type)) {
Expand Down
3 changes: 3 additions & 0 deletions test2.pl
Expand Up @@ -157,6 +157,9 @@
{
is $_, 5, '$_ passes into bare blocks';
}

sub foo($x is rw) { $x }
dies_ok { foo 5 }, "cannot rw-bind constant";
}

#is $?FILE, 'test.pl', '$?FILE works';
Expand Down

0 comments on commit 622e5dc

Please sign in to comment.