Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fallback to treating str TCs as class names

  • Loading branch information...
commit 607077d312c9bca7cad2e95331ccdd8db1e1b1d4 1 parent d63ba83
@ashb authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/TryCatch.pm
View
11 lib/TryCatch.pm
@@ -281,6 +281,16 @@ sub parse_proto {
return $self->parse_proto_using_pms($proto);
}
+sub _string_to_tc {
+ my ($class, $name) = @_;
+
+ my $tc = $class->find_registered_constraint($name);
+
+ return $tc if ref $tc;
+
+ return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($name)
+}
+
sub parse_proto_using_pms {
my ($self, $proto) = @_;
@@ -289,6 +299,7 @@ sub parse_proto_using_pms {
my $sig = Parse::Method::Signatures->new(
input => $proto,
from_namespace => $self->get_curstash_name,
+ type_constraint_callback => \&_string_to_tc,
);
my $errctx = $sig->ppi;
my $param = $sig->param;
Please sign in to comment.
Something went wrong with that request. Please try again.