You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You cannot use the type provided in a parametric role to constrain the return value of a method. It errors with "X::TypeCheck::Return exception produced no message".
use v6;
use Test;
role A[::B] {
method build-it(*@attr) {
return B.new(|@attr.Capture);
}
method build-it-constrain(*@attr) returns B {
return B.new(|@attr.Capture);
}
}
class Point {
has $.x;
has $.y;
}
plan 2;
lives-ok {
my Point $p = A[Point].new.build-it(x => 5, y => 10);
}, 'Built without constraint';
lives-ok {
my Point $p = A[Point].new.build-it-constrain(x => 5, y => 10);
}, 'Built with constraint';
Migrated from rt.perl.org#130364 (status was 'new')
Searchable as RT130364$
The text was updated successfully, but these errors were encountered: