Skip to content

Conversation

slavapestov
Copy link
Contributor

  • Description: Fixes a commonly-reported source compatibility regression in 4.0. If a closure's type was fully explicit (no type variables) we did not propagate the noescape bit from the call to the closure literal, thus we would require instance variables to be accessed with explicit "self." in cases where it was not needed before. Another related problem this also fixes was also present in 3.1 -- if a capture list was applied to a closure, we also required 'self.' qualification for instance variables (even if the capture list had nothing to do with 'self').

  • Scope of the issue: All the examples I saw involved immediately calling a closure literal, so I made a narrow fix for this case.

  • Origination: The original problem has existed for a long time but got worse recently.

  • Risk: Low, this only affects immediate calls of closures. The PR I submitted to master had a further cleanup of the logic, but it's not necessary here.

  • Tested: New tests added.

  • Reviewed by: @DougGregor

  • Radar: rdar://problem/32520406.

We cannot model a type variable bound to the ExtInfo of a function
type in the constraint solver, which means we have a hard time
propagating noescape-ness in some cases.

Fixes <rdar://problem/31910280> and <rdar://problem/32409133>.
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@tkremenek
Copy link
Member

@swift-ci test source compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants