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
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) Target: x86_64-apple-macosx10.9
md5: 6ec41517e9a1f2c684d6ec7852978b33
duplicates:
Issue Description:
class View {} protocol Delegate: class {} class ViewAndDelegate: View, Delegate {} class Subview<T>: View where T: View, T: Delegate { func something(argument: View) { guard let subtype = argument as? Subview<T> else { return } // do something with `subtype` let _ = subtype print("does not fail") } } let subview = Subview<ViewAndDelegate>() subview.something(argument: subview)
The line with the guard produces the following warning:
guard
Cast from 'View' to unrelated type 'Subview<T>' always fails
The cast succeeds if the user calls something(argument: subview) and "does not fail" gets printed on the console.
something(argument: subview)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 6ec41517e9a1f2c684d6ec7852978b33
duplicates:
Issue Description:
The line with the
guard
produces the following warning:The cast succeeds if the user calls
something(argument: subview)
and "does not fail" gets printed on the console.The text was updated successfully, but these errors were encountered: