From 826c3ead8208f3304f7ee99cc2575c2fbb3a8b6a Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Tue, 14 Jan 2020 19:21:08 +0100 Subject: [PATCH] Make searching for method name suggestions a bit more resilient 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. --- src/core.c/Exception.pm6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.c/Exception.pm6 b/src/core.c/Exception.pm6 index 3e371928d94..fb1815ba8f7 100644 --- a/src/core.c/Exception.pm6 +++ b/src/core.c/Exception.pm6 @@ -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; } } }