We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachment: Download
macOS: 10.13
Xcode: 9.0.1
Swift: 4.0
Platform: iOS
md5: ec12a9bd69d96f0c235d53cffae03696
duplicates:
Issue Description:
I write a syntactic sugar to optimize pattern matching for Optional:
extension Optional { static func ~=(lhs: Wrapped, rhs: Optional<Wrapped>) -> Bool { guard let unwrappedValue = rhs else { return false } return lhs ~= unwrappedValue } }
But the Wrapped may not have ~= function, but it still works in compile time:
struct Person { var name: String } var john. : Person? = Person(name: "John") var someone: Person = Person(name: "Someone") switch john { case someone : print("Someone Named John") default: print("") }
At runtime, it will cause a stack overflow, keep calling Optional.~=, there is a snapshot in attachment.
The text was updated successfully, but these errors were encountered:
I'm going to say SR-626 would have caught this issue!
Sorry, something went wrong.
No branches or pull requests
Attachment: Download
Environment
macOS: 10.13
Xcode: 9.0.1
Swift: 4.0
Platform: iOS
Additional Detail from JIRA
md5: ec12a9bd69d96f0c235d53cffae03696
duplicates:
Issue Description:
I write a syntactic sugar to optimize pattern matching for Optional:
But the Wrapped may not have ~= function, but it still works in compile time:
At runtime, it will cause a stack overflow, keep calling Optional.~=, there is a snapshot in attachment.
The text was updated successfully, but these errors were encountered: