[NFC] replace type-erased pattern matching with typed if-else blocks (#3840)
[NFC] replace type-erased pattern matching with typed if-else blocks (#3840)

This removes an unreachable `default` case, should result in less runtime cost.
abertelrud/swift-package-manager,abertelrud/swift-package-manager,apple/swift-package-manager,apple/swift-package-manager,apple/swift-package-manager,abertelrud/swift-package-manager,apple/swift-package-manager,abertelrud/swift-package-manager,abertelrud/swift-package-manager,apple/swift-package-manager