T M
class X::TypeCheck::Return
Error ReportCollection examples

Error due to a failed typecheck during return

class X::TypeCheck::Return is X::TypeCheck { }

Thrown when a return type check fails.

For example

sub f(--> Int{ "foo" }
f();
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::TypeCheck::Return: Type check failed for return value; expected Int but got Str ("foo")␤»