Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 88277
Status: resolved
Priority: 0/
Queue: Type-Tiny

People
Owner: perl [...] toby.ink
Requestors: STEVENL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.024
Fixed in: (no value)



Subject: Tuple validation unexpectedly successful
The following validation passes: sub test1 { state $check = compile( Tuple[Any, Any] ); my ($arg) = $check->(@_); } test1( [1, undef] ); # pass - as expected test1( [1] ) # pass - unexpected because no 2nd element I'm not sure if this was the intended behaviour but it was unexpected to me. I understand that `Any` accepts undefs, and we can get the expected behaviour if we change `Any` to `Defined`. Here's another example as a parallel with different behaviour: sub test2 { state $check = compile( Any, Any ); my $arg = [ $check->(@_) ]; } test2( 1, undef ); # pass - as expected test2( 1 ); # FAIL - as expected This second example makes more sense to me, and the first example has behaviour that is inconsistent with it.
I'd consider this to be a bug.
The fix is here: https://github.com/tobyink/p5-type-tiny/commit/711089b54e69b1ef04caaadd55b14db9871b7fbe I'll leave this ticket open until a stable version is released including the fix.
I've released a developer version 0.025_01 incorporating the fix.
Fixed in 0.026.