{{$NEXT}}
+ [DEPRECATIONS]
+
+ * The optimize_as option for type constraints has been deprecated. Use the
+ inline_as option to provide inlining code instead. (Dave Rolsky)
+
+
2.0200 Mon, Jul 18, 2011
[OTHER]
use warnings;
use Package::DeprecationManager 0.07 -deprecations => {
- 'default is for Native Trait' => '1.14',
- 'default default for Native Trait' => '1.14',
- 'coerce without coercion' => '1.08',
+ 'optimized type constraint sub ref' => '2.0000',
+ 'default is for Native Trait' => '1.14',
+ 'default default for Native Trait' => '1.14',
+ 'coerce without coercion' => '1.08',
},
-ignore => [qr/^(?:Class::MOP|Moose)(?:::)?/],
;
my %args = ref $first ? %$first : $first ? ($first, @rest) : ();
$args{name} = $args{name} ? "$args{name}" : "__ANON__";
+ if ( $args{optimized} ) {
+ Moose::Deprecated::deprecated(
+ feature => 'optimized type constraint sub ref',
+ message =>
+ 'Providing an optimized subroutine ref for type constraints is deprecated.'
+ . ' Use the inlining feature (inline_as) instead.'
+ );
+ }
+
my $self = $class->_new(%args);
$self->compile_type_constraint()
unless $self->_has_compiled_type_constraint;
sub _build_foo { q{} }
}
+{
+ use Moose::Util::TypeConstraints;
+
+ is(
+ exception {
+ stderr_like {
+ subtype 'Frubble', as 'Str', optimize_as sub { };
+ }
+ qr/\QProviding an optimized subroutine ref for type constraints is deprecated./,
+ 'Providing an optimize_as sub is deprecated';
+ },
+ undef
+ );
+}
+
done_testing;