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-8440] Using self inside a let initializer #50962

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

[SR-8440] Using self inside a let initializer #50962

swift-ci opened this issue Aug 1, 2018 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation duplicate Resolution: Duplicates another issue expressions Feature: expressions identifiers Feature: Identifiers missing warning Bug: Missing warning self Feature → expressions: The 'self' expression swift 5.6 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 1, 2018

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

Xcode 9.4.1 - Swift 4.1

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

md5: e2dca743fabfb653f26fcddaaaf02779

duplicates:

Issue Description:

Using self inside an initializer causes compiler error, which makes sense.

However, trying to use self to hookup a touchUpInside action on a UIKit object (for example UIButton) which is a let computed property doesn't cause compiler errors.

Below code is what I mean:

let someButton: UIButton = {
    let button = UIButton()
    button.addTarget(self, action: #selector(buttonTappedFunction), for: .touchUpInside)
}()

And the action doesn't work but the code compiles and runs.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added duplicate Resolution: Duplicates another issue diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis swift 5.6 expressions Feature: expressions missing warning Bug: Missing warning identifiers Feature: Identifiers self Feature → expressions: The 'self' expression labels May 2, 2023
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 diagnostics QoI Bug: Diagnostics Quality of Implementation duplicate Resolution: Duplicates another issue expressions Feature: expressions identifiers Feature: Identifiers missing warning Bug: Missing warning self Feature → expressions: The 'self' expression swift 5.6 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants