Skip to content

[Sema] Fix availability checking in inlinable code #33855

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

Merged
merged 12 commits into from
Oct 13, 2020

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Sep 8, 2020

Inlinable and @_alwaysEmitIntoClient functions can be inlined in clients with a lower OS target version than the framework defining the function. For this reason, the availability in inlinable functions should always be checked by using the introduction OS version specified by the explicit attributes as lower bound and not the minimum deployment version of the framework.

A side-effect of this change is rejecting unavailable overrides to available methods, in a similar way as overrides that are less available than the introduction are rejected. I believe this is the intended behavior as it provided inconsistent diagnostics and surprising behaviors.

rdar://problem/67975153

@xymus xymus changed the title [Sema] Fix checking of availability in inlinable code [Sema] Fix availability checking in inlinable code Sep 8, 2020
@xymus
Copy link
Contributor Author

xymus commented Sep 8, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Sep 8, 2020

@swift-ci Please test source compatibility

@xymus xymus force-pushed the availability-inlinable branch from 1da45b8 to f2f3d3e Compare September 11, 2020 04:58
@xymus
Copy link
Contributor Author

xymus commented Sep 11, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Sep 16, 2020

@swift-ci Please smoke test

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Sep 17, 2020

@swift-ci Please smoke test

@xymus xymus force-pushed the availability-inlinable branch from 0286dab to 64a48ec Compare September 18, 2020 07:03
@xymus
Copy link
Contributor Author

xymus commented Sep 18, 2020

@swift-ci Please smoke test

@xymus xymus force-pushed the availability-inlinable branch from 64a48ec to 315b01f Compare September 21, 2020 23:03
@xymus
Copy link
Contributor Author

xymus commented Sep 21, 2020

@swift-ci Please smoke test

@xymus xymus force-pushed the availability-inlinable branch from 315b01f to 692969a Compare September 21, 2020 23:07
@xymus
Copy link
Contributor Author

xymus commented Sep 21, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Sep 22, 2020

@swift-ci Please test source compatibility

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

@xymus xymus changed the base branch from master to main October 1, 2020 06:17
@xymus
Copy link
Contributor Author

xymus commented Oct 1, 2020

@swift-ci Please test source compatibility

@xymus xymus force-pushed the availability-inlinable branch from 692969a to c8c44d7 Compare October 6, 2020 21:27
@xymus
Copy link
Contributor Author

xymus commented Oct 6, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Oct 6, 2020

@swift-ci Please test source compatibility

@xymus
Copy link
Contributor Author

xymus commented Oct 7, 2020

@swift-ci Please smoke test macOS platform

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Oct 7, 2020

@swift-ci Please smoke test macOS platform

@xymus
Copy link
Contributor Author

xymus commented Oct 7, 2020

@swift-ci Please test source compatibility

@xymus xymus force-pushed the availability-inlinable branch from c8c44d7 to 94608f9 Compare October 8, 2020 18:16
@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please test source compatibility

@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please smoke test macOS platform

@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please smoke test Linux platform

@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please test source compatibility

@xymus
Copy link
Contributor Author

xymus commented Oct 8, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Oct 9, 2020

@swift-ci Please test source compatibility

xymus added 11 commits October 9, 2020 10:40
Inlinable functions can be inlined in clients with a lower OS target
version than the framework defining the function. For this reason, the
availability in inlinable functions should always be checked using the
explicit introduction OS version as lower bound and not the minimum
deployment version.

rdar://problem/67975153
This has the effect of rejecting unavailable overrides to available
methods in a similar way as overrides that are less available than the
introduction are rejected.
The errors on explicit unavailability are more precise than those on
availablity version. Make sure we prioritize the unavailability ones
first.
Don't raise the error availability_decl_more_than_enclosing in the
context is unavailable and if read in a swiftinterface file. This error
was present in the stdlib in 5.3 without side effects so we still want
to accept it.
Preserve the old behavior of accepted unavailable override of
constructors as this change would be source breaking.
…aces

Preserve the previous behavior when parsing swiftinterfaces as the Swift
stdlib for Swift 5.3 and a few other swiftinterfaces in Xcode 12.0 had
issues that would now be reported as errors.
@xymus xymus force-pushed the availability-inlinable branch from 94608f9 to fca7d36 Compare October 9, 2020 17:58
@xymus
Copy link
Contributor Author

xymus commented Oct 9, 2020

@swift-ci Please smoke test

@beccadax
Copy link
Contributor

beccadax commented Oct 9, 2020

Restarting doomed Linux tests.

@swift-ci please smoke test Linux platform

@xymus
Copy link
Contributor Author

xymus commented Oct 9, 2020

@swift-ci Please test source compatibility

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Oct 9, 2020

@swift-ci Please test source compatibility

Report unavailable overrides as a warning to avoid breaking sources.
@xymus
Copy link
Contributor Author

xymus commented Oct 13, 2020

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Oct 13, 2020

@swift-ci Please 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.

4 participants