Created
December 2, 2012 16:32
-
-
Save moritz/4189639 to your computer and use it in GitHub Desktop.
Trying to fix nqp::can(role { }, "something")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Metamodel/ParametricRoleGroupHOW.pm b/src/Perl6/Metamodel/ParametricRoleGroupHOW.pm | |
index 075d5a5..82f1e3f 100644 | |
--- a/src/Perl6/Metamodel/ParametricRoleGroupHOW.pm | |
+++ b/src/Perl6/Metamodel/ParametricRoleGroupHOW.pm | |
@@ -115,4 +115,11 @@ class Perl6::Metamodel::ParametricRoleGroupHOW | |
} | |
0; | |
} | |
+ | |
+ method declares_method($obj, $name) { | |
+ for @!possibilities { | |
+ return 1 if $_.HOW.declares_method($obj, $name); | |
+ } | |
+ 0; | |
+ } | |
} | |
diff --git a/src/Perl6/Metamodel/RolePunning.pm b/src/Perl6/Metamodel/RolePunning.pm | |
index fcdab81..2e091f4 100644 | |
--- a/src/Perl6/Metamodel/RolePunning.pm | |
+++ b/src/Perl6/Metamodel/RolePunning.pm | |
@@ -39,6 +39,9 @@ role Perl6::Metamodel::RolePunning { | |
if nqp::existskey(%exceptions, $name) { | |
return nqp::findmethod(%exceptions{$name}, $name); | |
} | |
+ unless self.declares_method($obj, $name) { | |
+ return nqp::null(); | |
+ } | |
unless $!made_pun { | |
$!pun := self.make_pun($obj); | |
$!made_pun := 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make -j4 && ./perl6 -Ilib t/spec/S05-interpolation/regex-in-variable.rakudo | |
1..33 | |
ok 1 - Simple scalar match 1 | |
ok 2 - Simple scalar match 2 | |
ok 3 - Simple scalar match 3 | |
ok 4 - Nested scalar match 1 | |
ok 5 - Nested scalar match 2 | |
ok 6 - Nested scalar match 3 | |
ok 7 - Rulish scalar match 1 | |
ok 8 - Rulish scalar match 2 | |
ok 9 - Rulish scalar match 3 | |
No such method 'dispatch:<.^>' for invocant of type 'CachedCompiledRegex' | |
in sub infix:<does> at src/gen/CORE.setting:11980 | |
in sub MAKE_REGEX at src/gen/CORE.setting:10385 | |
in regex at t/spec/S05-interpolation/regex-in-variable.rakudo:43 | |
in method match at src/gen/CORE.setting:4297 | |
in block at t/spec/S05-interpolation/regex-in-variable.rakudo:43 | |
# Looks like you planned 33 tests, but ran 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment