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-8602] Self implicitness too strong #51118

Closed
swift-ci opened this issue Aug 22, 2018 · 0 comments
Closed

[SR-8602] Self implicitness too strong #51118

swift-ci opened this issue Aug 22, 2018 · 0 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

Previous ID SR-8602
Radar None
Original Reporter charlieMonroe (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

macOS 10.13, Xcode 10, 4.2 development snapshot Aug 21

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

md5: 88ea6baea7bf50eddae0a1b4359f3b57

duplicates:

  • SR-1772 File-level function with the same name as instance function not picked up by compiler

Issue Description:

Please, see the following example:

enum FooType {
    case foo1
    case foo2
}

class Foo {
    func printClassName() {
        print(NSStringFromClass(type(of: self)))
    }
    
    var type: FooType {
        return .foo1
    }
}

type(of: self) is marked with error cannot call value of non-function type 'FooType' which is obviously wrong as I'm calling type(of🙂, not self.type. The obvious solution is to use Swift.type(of🙂, but for a person that always uses the explicit self, this is not a nice solution. Though not sure what the correct solution would be here - probably to also include the global namespace in the lookup?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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

1 participant