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
XCode Version 9.4 (9F1027a)
macOS 10.13.5 (17F77)
md5: fcb1e646cb39224c618fdec43f9e5bbd
duplicates:
Issue Description:
This issue has two related manifestations - I believe it's a single bug (or two closely related)
Consider playground like this (working)
class SomeClass { } protocol Foo: class { // <-- this line 4 affects everything var isFooable: Bool { get set } } class ConcreteClass: SomeClass, Foo { var isFooable: Bool = false } let instance: SomeClass = ConcreteClass() if let foo = instance as? Foo { foo.isFooable = false foo.isFooable }
1) now if we change line 4 to
protocol Foo where Self: SomeClass {
we get an error at line
foo.isFooable = false
claiming foo is a let constant though I believe AnyObject reference behavior should be inferred
2) if we now change the condition to
if var foo = instance as? Foo {
we get EXC_BAD_EXEC at the line where we read the value (surprisingly not where we assign it)
3) we change protocol declaration to
protocol Foo: class where Self: SomeClass {
now all is working but we get two warnings
first for the protocol declaration saying that Self: Any Class is redundant (but see 1) - it did not work if was not present
second we don not have to declare foo as var in the conditional binding, what makes sense and can be easily fixed indeed
The text was updated successfully, but these errors were encountered:
@slavapestov, another for your group of "protocols constrained to classes isn't really supported yet"?
Sorry, something went wrong.
slavapestov
No branches or pull requests
Environment
XCode Version 9.4 (9F1027a)
macOS 10.13.5 (17F77)
Additional Detail from JIRA
md5: fcb1e646cb39224c618fdec43f9e5bbd
duplicates:
Issue Description:
This issue has two related manifestations - I believe it's a single bug (or two closely related)
Consider playground like this (working)
1) now if we change line 4 to
we get an error at line
claiming foo is a let constant though I believe AnyObject reference behavior should be inferred
2) if we now change the condition to
we get EXC_BAD_EXEC at the line where we read the value (surprisingly not where we assign it)
3) we change protocol declaration to
now all is working but we get two warnings
first for the protocol declaration saying that Self: Any Class is redundant (but see 1) - it did not work if was not present
second we don not have to declare foo as var in the conditional binding, what makes sense and can be easily fixed indeed
The text was updated successfully, but these errors were encountered: