return $val unless $self->has_type_constraint;
$val = $self->type_constraint->coerce($val)
- if $self->should_coerce;
+ if $self->should_coerce && $self->type_constraint->has_coercion;
$self->verify_against_type_constraint($val, instance => $instance);
push @source => ('my $val = $params->{\'' . $init_arg . '\'};');
if ($is_moose && $attr->has_type_constraint) {
- if ($attr->should_coerce) {
+ if ($attr->should_coerce && $attr->type_constraint->has_coercion) {
push @source => $self->_generate_type_coercion(
$attr,
'$type_constraints[' . $index . ']',
return unless $attr->has_type_constraint;
my @source;
- if ($attr->should_coerce) {
+ if ($attr->should_coerce && $attr->type_constraint->has_coercion) {
push @source => $self->_generate_type_coercion(
$attr,
'$type_constraints[' . $index . ']',