This line currently fails to compile if called on a String.UTF8View or String.UTF16View.
String(Substring) always returns a valid value, but String(Substring.UTF8View) or the same for UTF16View will return nil if the argument is not valid UTF8 or UTF16. Since we know self is valid, we can safely assert that a substring of self is valid and that the String initializer will return non-nil.
Actually, it looks like this is due to an issue with the SWIFT_VERSION config and this is being compiled as Swift 3 in my project. I'll put out a different pull request once I've tracked down the appropriate fix.
This line currently fails to compile if called on a String.UTF8View or String.UTF16View.
String(Substring) always returns a valid value, but String(Substring.UTF8View) or the same for UTF16View will return nil if the argument is not valid UTF8 or UTF16. Since we know self is valid, we can safely assert that a substring of self is valid and that the String initializer will return non-nil.