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-12086] No-escape blocks in function builder now require explicit self #54522

Closed
swift-ci opened this issue Jan 25, 2020 · 15 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself result builders Feature: Result builders type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12086
Radar rdar://problem/58997196
Original Reporter zetasq (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 11.3.1 (11C504) with development snapshot (January 23, 2020 Master branch)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, FunctionBuilder, TypeChecker
Assignee zetasq (JIRA)
Priority Medium

md5: 67c15c002b60d7027d8fd173b38740a1

Issue Description:

In the latest development snapshot (January 23, 2020 Master branch), the code in the playground (see attachment) cannot compile. An error is emitted says "Reference to property 'iuoObj' in closure requires explicit use of 'self' to make capture semantics explicit". But the closure is non-escaping, so this code should be compiled with no error.

@theblixguy
Copy link
Collaborator

Works fine for me on master. Please try again with the next available snapshot.

@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Zhu Shengqi (JIRA)

The code still failed to compile with latest snapshot (January 24, 2020). I have provided the Xcode version and the snapshot version. Anyone want to fix the issue should try to reproduce it first, not just saying "works fine for me".

@theblixguy
Copy link
Collaborator

Sorry, I did try it yesterday and it worked for me. See:

![](Screenshot 2020-01-26 at 02.25.25.png)

Let me pull from master again and retry.

@swift-ci
Copy link
Collaborator Author

Comment by Zhu Shengqi (JIRA)

You are not using the same environment as I do. I use Xcode 11.3.1 (11C504) with development snapshot, while you are using terminal with swift git repo.

@theblixguy
Copy link
Collaborator

I don’t think Xcode is going to make any difference given this is a Swift error, but I will verify with Xcode as well. There are two snapshots, a “trunk” snapshot and a 5.2 development snapshot. They are different, so could you confirm which one you’re using exactly?

@swift-ci
Copy link
Collaborator Author

Comment by Zhu Shengqi (JIRA)

I use snapshot under the "Trunk development (master)" category.

@swift-ci
Copy link
Collaborator Author

Comment by Zhu Shengqi (JIRA)

I just download the "Swift 5.2 development" snapshot and the code compiles with it. So either the code in "Trunk development (master)" introduce a new bug, or a fix is committed in "Swift 5.2 development" but not merged back to "Trunk development (master)" yet. Can someone verify which is the case?

@swift-ci
Copy link
Collaborator Author

Comment by Zhu Shengqi (JIRA)

And if master branch mentioned above corresponds to the "Trunk development (master)", then there may be some problem when the CI create the snapshots.

@theblixguy
Copy link
Collaborator

Okay, I can reproduce it with the latest trunk snapshot and on the master branch I just pulled from. This is strange, because it compiled successfully before (as I showed earlier). So I think something has regressed since then.

@theblixguy
Copy link
Collaborator

Looking into this a bit more - this PR added a call to performSyntacticExprDiagnostics during builder transform, which is triggering this diagnostic. It seems like we're running the check a bit early - the closure does not have a type set, which means we're unable to determine if the closure is marked noescape or not.

@hborla
Copy link
Member

hborla commented Feb 5, 2020

This PR should fix the issue: #29649

@LucianoPAlmeida
Copy link
Collaborator

@hborla, since PR was merged this should be resolved?

@hborla
Copy link
Member

hborla commented Mar 3, 2020

@LucianoPAlmeida oops, yes, thank you!

@hborla
Copy link
Member

hborla commented Mar 3, 2020

The issue has been fixed on master. Could you please verify using a recent master snapshot? Thank you!

@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 result builders Feature: Result builders type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

5 participants