Skip to content

Commit

Permalink
Check type before looking for qualified method
Browse files Browse the repository at this point in the history
This fixes a failing test in S12-methods/qualified.t on the JVM
backend. The code in src/vm/moar/spesh-plugins.nqp does a similiar
check before calling 'find_method_qualified'.

A somewhat golfed version of the failing test would be:

  role R  { method x { 'R::x'  } }
  class C { method x { self does R; self.R::x } }
  say C.new.x;

Running this code fails with

  No concretization found for R

instead of printing 'R::x' on the JVM backend.
  • Loading branch information
usev6 committed Jan 1, 2020
1 parent 186c4ce commit 5648a4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core.c/Mu.pm6
Expand Up @@ -810,7 +810,8 @@ Perhaps it can be found at https://docs.perl6.org/type/$name"
}
$ctx := nqp::ctxouterskipthunks($ctx);
} while $ctx && !$sym-found;
$meth = $caller-type.^find_method_qualified($type, $name) if $sym-found;
$meth = $caller-type.^find_method_qualified($type, $name)
if $sym-found && nqp::istype($caller-type, $type);
$meth = self.^find_method_qualified($type, $name) unless $meth;
}

Expand Down

0 comments on commit 5648a4f

Please sign in to comment.