You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, the where clause is applied to the default value, the undefined
type Any
and results in an error.
$ perl6
sub a(Range $r? where {$r.min >= 0} ) {}; a()
Type objects are abstract and have no attributes, but you tried to
access $!min
Rejecting this one - it's behaving as expected. From #perl6:
12:31 <@jnthn> Opinions on http://rt.perl.org/rt3/Ticket/Display.html?id=76514 ?
12:31 <@jnthn> Tempted to reject as "not a bug".
12:31 <@jnthn> Default values should be subject to checking too.
12:32 <@moritz_> +1
12:32 <@jnthn> (and sticking in the Range type object is just a kinda
default value)
12:32 <@moritz_> the correct solution is to supply a custom default
value, of course
12:36 <@jnthn> OK, thanks. :-)
Essentially, if you're going to put constraints on a parameter or
variable, then those constraints should always apply. You could:
* Supply a default value
* Tweak the constraint to allow !$r.defined || $r.min >= 0
Migrated from rt.perl.org#76514 (status was 'rejected')
Searchable as RT76514$
The text was updated successfully, but these errors were encountered: