Combined from primary sources listed below.
See primary docmentation in context for method ACCEPTS.
multi method ACCEPTS(Any:D: Mu $other)
Usage:
EXPR.ACCEPTS(EXPR);
Returns True if $other === self (i.e. it checks object identity).
Many built-in types override this for more specific comparisons.
See primary docmentation in context for method ACCEPTS.
multi method ACCEPTS(IO::Path:D: Cool:D $other --> Bool:D)
Coerces the argument to IO::Path, if necessary. Returns True if .absolute method on both paths returns the same string. NOTE: it's possible for two paths that superficially point to the same resource to NOT smartmatch as True, if they were constructed differently and were never fully resolved:
say "foo/../bar".IO ~~ "bar".IO # False
The reason is the two paths above may point to different resources when fully resolved (e.g. if foo is a symlink). Resolve the paths before smartmatching to check they point to same resource:
say "foo/../bar".IO.resolve(:completely) ~~ "bar".IO.resolve(:completely) # True