Skip Menu |

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

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

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

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Dict type doesn't notice missing Bool elements
Given Dict[ a=>Bool, b=>Int ] a missing Int field is detected: $ perl -MTypes::Standard=Dict,Bool,Int -we '(Dict[ a=>Bool, b=>Int ])->assert_valid({a=>1})' {"a" => 1} did not pass type constraint "Dict[a=>Bool,b=>Int]" at -e line 1. but a missing Bool field isn't: perl -MTypes::Standard=Dict,Bool,Int -we '(Dict[ a=>Bool, b=>Int ])->assert_valid({b=>1})'
Fixed on Github, and the following test cases have been added to the test suite... my $struct5 = Dict[ i => Maybe[Int], b => Bool ]; should_pass({ i => 42, b => undef }, $struct5); should_pass({ i => 42, b => '' }, $struct5); should_pass({ i => 42, b => 0 }, $struct5); should_pass({ i => 42, b => 1 }, $struct5); should_pass({ i => undef, b => 1 }, $struct5); should_fail({ b => 42, i => 1 }, $struct5); should_fail({ i => 42 }, $struct5); should_fail({ b => 1 }, $struct5); should_fail({ i => 42, b => 1, a => 1 }, $struct5); should_fail({ i => 42, a => 1 }, $struct5); should_fail({ a => 42, b => 1 }, $struct5);
Just uploaded 0.021_04 which includes the fix for this.
Resolved in 0.022.