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-14120] 'explicit self required' error not produced in nested escaping closure #56501

Open
swift-ci opened this issue Jan 28, 2021 · 3 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 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14120
Radar rdar://problem/73768285
Original Reporter jumhyn (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

md5: f42524ac4dfefbfd1f34802145d493e6

Issue Description:

According to SE-0269, the following code should be invalid, but it compiles just fine:

class Test {
    var x = 0
    func execute(_ work: @escaping () -> Void) {
        work()
    }
    func method() {
        execute { [self] in
            execute {
                x += 1
            }
        }
    }
}
@swift-ci
Copy link
Collaborator Author

Comment by Frederick Kellison-Linn (JIRA)

At this point, it would be a source break to disallow this code, so maybe we should just modify the proposal to reflect the actual behavior?

@xwu
Copy link
Collaborator

xwu commented Jan 29, 2021

I think it can surely be made a warning for now, with a later upgrade to an error if desired.

@typesanitizer
Copy link

@swift-ci create

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants