# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #119759]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119759 >


<timotimo> masak:
https://github.com/masak/crypt/blob/master/t/hanoi.t#L5  -  can you
imagine why this would explode with this error: Nominal type check
failed for parameter ''; expected Any but got LargerOnSmaller instead
(when called from line 39)
<timotimo> as far as i can see, LargerOnSmaller is derived from X::Hanoi
<timotimo> and X::Hanoi is Exception
<timotimo> r: class X::Hanoi is Exception { class LargerOnSmaller is
X::Hanoi { method message { "you can't do that" } } }; sub
testsub($ex_type) { say $ex_type; };
testsub(X::Hanoi::LargerOnSmaller);
<camelia> rakudo 69c3cc: OUTPUT«Nominal type check failed for
parameter '$ex_type'; expected Any but got LargerOnSmaller instead␤
in sub testsub [...]
<timotimo> r: class X::Hanoi is Exception { class LargerOnSmaller is
X::Hanoi { method message { "you can't do that" } } }; sub
testsub(Mu:U $ex_type) { say $ex_type.message; };
testsub(X::Hanoi::LargerOnSmaller);
<camelia> rakudo 69c3cc: OUTPUT«you can't do that␤»
<timotimo> i'm kind of getting the feeling that putting the class
definition into the other class is making it bork
<masak> r: class A is Exception { class B is A {} }; sub foo($x) {}; foo(A::B)
<camelia> rakudo 69c3cc: OUTPUT«Nominal type check failed for
parameter '$x'; expected Any but got B instead␤  in sub foo [...]
<masak> timotimo: yes.
* masak submits rakudobug
<masak> r: class A is Exception {}; class C { class B is A {} }; sub
foo($x) {}; foo(C::B)
<camelia> rakudo 69c3cc:  ( no output )
<masak> hm; nesting in the same class you inherit from seems to be a
required part of the problem.

Reply via email to