File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,17 @@ Revision history for MooseX-Types
2
2
3
3
{{$NEXT}}
4
4
5
+ - re-added the is_Foo and to_Food refactoring after resolving
6
+ RT #119534
7
+
5
8
0.50 2017-02-07 18:59:30Z
6
9
- reverted the is_Foo and to_Foo refactoring again temporarily to
7
10
resolve issues with Sub::Defer
8
11
9
12
0.49 2016-12-23 00:12:12Z
10
13
- made the exported is_Foo and to_Foo subs much faster, especially for
11
14
type constraints which can be inlined. (Dave Rolsky) [reverted in
12
- 0.50)
15
+ 0.50]
13
16
14
17
0.48 2016-12-07 01:15:14Z
15
18
- reverted is_Foo and to_Foo refactoring [from 0.47] for now, so they
Original file line number Diff line number Diff line change @@ -491,9 +491,11 @@ sub coercion_export_generator {
491
491
my ($value ) = @_ ;
492
492
493
493
# we need a type object
494
- my $tobj = find_type_constraint($full ) or croak $undef_msg ;
494
+ my $tobj = find_type_constraint($full );
495
495
496
496
return sub {
497
+ croak $undef_msg unless $tobj ;
498
+
497
499
my $return = $tobj -> coerce($_ [0]);
498
500
499
501
# non-successful coercion returns false
@@ -517,11 +519,15 @@ sub check_export_generator {
517
519
my ($value ) = @_ ;
518
520
519
521
# we need a type object
520
- my $tobj = find_type_constraint($full ) or croak $undef_msg ;
522
+ my $tobj = find_type_constraint($full );
521
523
522
524
# This method will actually compile an inlined sub if possible. If
523
525
# not, it will return something like sub { $tobj->check($_[0]) }
524
- return $tobj -> _compiled_type_constraint;
526
+ #
527
+ # If $tobj is undef, we delay the croaking until the check is
528
+ # actually used for backward compatibility reasons. See
529
+ # RT #119534.
530
+ return $tobj ? $tobj -> _compiled_type_constraint : sub { croak $undef_msg };
525
531
}
526
532
}
527
533
Original file line number Diff line number Diff line change @@ -25,4 +25,17 @@ unlike(
25
25
' is_Int sub is now undeferred'
26
26
);
27
27
28
+ {
29
+ package MyTypes ;
30
+
31
+ use MooseX::Types -declare => [' Unused' ];
32
+
33
+ }
34
+
35
+ is(
36
+ exception { undefer_all() },
37
+ undef ,
38
+ ' Sub::Defer::undefer_all does not throw an exception with unused type declaration'
39
+ );
40
+
28
41
done_testing();
You can’t perform that action at this time.
0 commit comments