fix issue 9959 - Add functional pattern matching for object references

Add the function std.algorithm.castSwitch, which chooses a delegate
based on the class of an object and run that delegate with that object.
Make std.file.getLinkAttributes safe
Mark std.file.isDir and its unittest as safe
Merge pull request #2517 from tom-tan/safe-file-isDir

Mark std.file.isDir and its unittest as safe
Merge pull request #2516 from tom-tan/safe-file-getLinkAttributes

Make std.file.getLinkAttributes safe
Mark unittests for std.file.attrIsDir and attrIsFile as safe
Merge pull request #2519 from tom-tan/safe-unittest-for-file-attrIsDir-attrIsFile

Mark unittests for std.file.attrIsDir and attrIsFile as safe
Merge pull request #1266 from idanarye/add-functional-pattern-matching-for-object-references

fix issue 9959 - Add functional pattern matching for object references