Skip to content
New issue

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

[SR-7155] Member operators cannot be referenced using dot syntax #49703

Open
swift-ci opened this issue Mar 9, 2018 · 2 comments
Open

[SR-7155] Member operators cannot be referenced using dot syntax #49703

swift-ci opened this issue Mar 9, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Mar 9, 2018

Previous ID SR-7155
Radar None
Original Reporter erica (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: c6484910984c9bb02a6fdbccf9ebd538

Issue Description:

Xcode does not complete static operator implementations. For example:

struct Foo: Comparable {

*static* *func* fooify(\_\_\_ string: String) -\> String {

    *return* "foo"

}

*static* *func* ==(lhs: Foo, rhs: Foo) -\> Bool { *return* *true* }

*static* *func* \<(lhs: Foo, rhs: Foo) -\> Bool { *return* *true* }

}

typealias Fooquatable = (Foo, Foo) -> Bool

![](Screen Shot 2018-03-09 at 8.44.55 AM.png)

Neither `==` nor `<` is listed and you cannot refer to `Foo.==` or `Foo.<` in code.

@belkadan
Copy link
Contributor

belkadan commented Mar 9, 2018

This is not really a code completion bug, because you can't use that syntax anywhere at the moment!

@rudkx
Copy link
Member

rudkx commented Mar 9, 2018

This is a quick brain-dump I did last weekend on how I think we can fix expression type checking times for expressions involving operators. Although it doesn't (yet) explicitly mention support for explicit operator references like this, I was intending on fleshing out the details to explicitly support that as well: https://github.com/rudkx/swift-evolution/blob/operators-as-members/proposals/9999-operators-as-members.md

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants