Skip to content

Commit

Permalink
Make searching for method name suggestions a bit more resilient
Browse files Browse the repository at this point in the history
Some bugs, especially when dealing with the setting and additions,
can cause strange types of values to occur.  Make sure that StrDistance
only gets strings, and that the suggestion is stored as a string.
This should have made searching for the "is_built" problem a *lot*
easier.
  • Loading branch information
lizmat committed Jan 14, 2020
1 parent da9929c commit 826c3ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.c/Exception.pm6
Expand Up @@ -185,9 +185,9 @@ my class X::Method::NotFound is Exception {

if nqp::can($!invocant.HOW, 'methods') {
for $!invocant.^methods(:all)>>.name -> $method_name {
my $dist = StrDistance.new(:before($.method), :after($method_name));
my $dist = StrDistance.new(:before($.method), :after(~$method_name));
if $dist <= $max_length {
%suggestions{$method_name} = $dist;
%suggestions{$method_name} = ~$dist;
}
}
}
Expand Down

0 comments on commit 826c3ea

Please sign in to comment.