The following fails with X::Parameter::InvalidType, which looks good to me. I 
added a test to S14-roles/basic.t with commit 
https://github.com/perl6/roast/commit/cf760b1f69

$ perl6 -e 'role A::B { method foo(A::C $a) { } }'
===SORRY!=== Error while compiling -e
Invalid typename 'A::C' in parameter declaration.
at -e:1
------> role A::B { method foo(A::C⏏ $a) { } }

If there is just type A in the signature the error differs, though:

$ perl6-m -e 'role A::B { method foo(A $a) { } }'   # fails with X::AdHoc
===SORRY!=== Error while compiling -e
A cannot be used as a nominal type on a parameter
at -e:1
------> role A::B { method foo(A ⏏$a) { } }

std has the same error message for both commands:

<bartolin> std: role A::B { method foo(A::C $a) { } }
<+camelia> std f9b7f55: OUTPUT«===SORRY!===␤In parameter declaration, typename 
'A::C' must be predeclared (or marked as declarative with :: prefix) at 
                 /tmp/pKMilacEPI line 1:␤------> role A::B { method foo(A::C⏏ 
$a) { } }␤Parse failed␤FAILED 00:00…»
<bartolin> std: role A::B { method foo(A $a) { } }
<+camelia> std f9b7f55: OUTPUT«===SORRY!===␤In parameter declaration, typename 
'A' must be predeclared (or marked as declarative with :: prefix) at 
                 /tmp/MD0GLvANd_ line 1:␤------> role A::B { method foo(A⏏ $a) 
{ } }␤Parse failed␤FAILED 00:00 138m␤»

Reply via email to