@@ -3,7 +3,7 @@ use lib <t/spec/packages>;
3
3
use Test ;
4
4
use Test ::Util;
5
5
6
- plan 18 ;
6
+ plan 19 ;
7
7
8
8
sub f ($ x ) returns Int { return $ x };
9
9
@@ -39,12 +39,30 @@ dies-ok { g('m') }, 'type check forbids bad implicit return';
39
39
40
40
# RT #126124
41
41
{
42
- throws-like { sub f (Mu : D $ a ) {}; f(Int ) }, Exception ,
43
- message => /'instance of type Mu' .+ 'type object' /,
44
- ' type shown in the exception message is the right one' ;
45
- throws-like { sub f (Mu : U $ a ) {}; f(123 ) }, Exception ,
46
- message => /'object of type Mu' .+ 'object instance' /,
47
- ' type shown in the exception message is the right one' ;
42
+ throws-like { sub f (Mu : D $ a ) {}; f(Int ) }, X::Parameter::InvalidConcreteness ,
43
+ expected => ' Mu' ,
44
+ got => ' Int' ,
45
+ param => ' $a' ,
46
+ routine => ' f' ,
47
+ should-be-concrete => ' True' ,
48
+ param-is-invocant => ' False' ,
49
+ ' expected and got types in the exception are the correct ones' ;
50
+ throws-like { sub f (Mu : U $ a ) {}; f(123 ) }, X::Parameter::InvalidConcreteness ,
51
+ expected => ' Mu' ,
52
+ got => ' Int' ,
53
+ param => ' $a' ,
54
+ routine => ' f' ,
55
+ should-be-concrete => ' False' ,
56
+ param-is-invocant => ' False' ,
57
+ ' expected and got types in the exception are the correct ones' ;
58
+ throws-like { UInt . abs }, X::Parameter::InvalidConcreteness ,
59
+ expected => ' Int' ,
60
+ got => ' UInt' ,
61
+ param => ' <anon>' ,
62
+ routine => ' abs' ,
63
+ should-be-concrete => ' True' ,
64
+ param-is-invocant => ' True' ,
65
+ ' expected and got types in the exception are the correct ones' ;
48
66
}
49
67
50
68
# RT #129279
0 commit comments