Open djerius opened 1 year ago
The docs for Type::Tiny::constraint_generator state:
Type::Tiny::constraint_generator
Coderef that is called when a type constraint is parameterized. When called, it is passed the list of parameters,
And the docs for Type::Tiny::coercion_generator state:
Type::Tiny::coercion_generator
Called with the same parameters and package variables as the "constraint_generator".
However, it's actually called as
$code->( $self, $child_type, @args )
I.E.
1163 $P = $self->create_child_type( %options ); 1164 1165 if ( $self->has_coercion_generator ) { 1166 my @args = @_; 1167 $P->{_build_coercion} = sub { 1168 my $coercion = shift; 1169 my $built = $self->coercion_generator->( $self, $P, @args ); 1170 $coercion->add_type_coercions( @{ $built->type_coercion_map } ) if $built; 1171 $coercion->freeze; 1172 }; 1173 }
Mistake in title (fixed): it's coercion_generator, not constraint_generator.
The docs for
Type::Tiny::constraint_generator
state:And the docs for
Type::Tiny::coercion_generator
state:However, it's actually called as
I.E.