Incorrect API docs for Type::Tiny::coercion_generator
djerius opened this issue · 1 comments
djerius commented
The docs for Type::Tiny::constraint_generator
state:
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:
Called with the same parameters and package variables as the "constraint_generator".
However, it's actually called as
$code->( $self, $child_type, @args )
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 }
djerius commented
Mistake in title (fixed): it's coercion_generator, not constraint_generator.