Skip to content

Instantly share code, notes, and snippets.

@salortiz
Last active July 9, 2016 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salortiz/e5434418ff26774eeeb7ebac20da630d to your computer and use it in GitHub Desktop.
Save salortiz/e5434418ff26774eeeb7ebac20da630d to your computer and use it in GitHub Desktop.
diff --git a/src/core/Str.pm b/src/core/Str.pm
index 1693e60..d6e5061 100644
--- a/src/core/Str.pm
+++ b/src/core/Str.pm
@@ -43,9 +43,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
nqp::findnotcclass(nqp::const::CCLASS_NUMERIC,$s,0,$chars),
$chars
) ?? nqp::atpos(nqp::radix_I(10,$s,0,0,Int),0)
- !! self.Numeric.Int;
+ !! (given self.Numeric { when Failure { $_ }; .Int });
}
- method Num(Str:D:) { self.Numeric.Num; }
+ method Num(Str:D:) { given self.Numeric { when Failure { $_ }; .Num } }
multi method ACCEPTS(Str:D: Str:D \other) {
nqp::p6bool(nqp::iseq_s(nqp::unbox_s(other),$!value));
@salortiz
Copy link
Author

salortiz commented Jul 9, 2016

This fix 'A'.Int and 'A'.Num to propagate the failure like 'A'.Numeric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment