You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am defining a protocol that has a requirement to be implemented only by a specific Objective-C class. If I define the protocol like this the code compile but I get a warning:
If I remove the redundant definition then I get a value semantic error:
protocolAwhereSelf: NSObject {
varp: NSObject { getset }
}
classB {
funcdoSomethingWith(a: A) {
// Compiler error: Cannot assign to property: 'a' is a 'let' constanta.p = NSObject()
}
}
More on this:
Instead of using a property I have defined a setter method (see bellow with a close to the reality example) instead of property, in the same way if I declare the class restriction I get the warning but the code works.
If I remove the class restriction in the protocol definition I get a crash:
error: Playground execution aborted: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
The text was updated successfully, but these errors were encountered:
Environment
Xcode 9.2 (9C40b)
Swift 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Additional Detail from JIRA
md5: a48f0f6b52d1f7e64830730271baf2ab
duplicates:
relates to:
Issue Description:
I am defining a protocol that has a requirement to be implemented only by a specific Objective-C class. If I define the protocol like this the code compile but I get a warning:
If I remove the redundant definition then I get a value semantic error:
More on this:
Instead of using a property I have defined a setter method (see bellow with a close to the reality example) instead of property, in the same way if I declare the class restriction I get the warning but the code works.
If I remove the class restriction in the protocol definition I get a crash:
The text was updated successfully, but these errors were encountered: