Skip to content

Generic type alias access level regression [4.2 04/30/2018] #16585

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

Conversation

slavapestov
Copy link
Contributor

  • Description: Fixes a regression with access level checking from recent work on generic typealiases in the 4.2 branch.

  • Scope of the issue: Code that was correctly rejected in 4.1 was being accepted, which could cause linker errors if someone tried to rely on the incorrect behavior.

  • Origination: I noticed this by inspection while working on other changes.

  • Risk: Low, it's a simple change.

  • Tested: New test added.

  • Reviewed by: @DougGregor or @jrose-apple

  • Radar: rdar://problem/40188409.

In Swift 3 mode, the canonical private DeclContext should
not look through extensions.

The only way I can reproduce this is with a missing warning
and we don't really care about missing warnings in Swift 3 mode.

However, the next patch in this PR regresses more things so
let's fix it properly.
If a property had an inferred type that is a generic type alias,
we weren't checking the access level of the generic arguments.

This used to work in 4.1 because we didn't have a sugared
representation for generic type aliases, so we were checking
the substituted underlying type here. But now that NameAliasType
can store generic arguments, make sure we visit them here.

Fixes <rdar://problem/40188409>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c2153ff

@slavapestov
Copy link
Contributor Author

The test failures are not mine...

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.

Thank you!

@airspeedswift
Copy link
Member

Those test failures are specific to one machine...

@airspeedswift
Copy link
Member

@swift-ci please test

@airspeedswift
Copy link
Member

Oops forgot the "macOS platform" there, ah well. The macOS tests are running on a different machine this time though.

@AnnaZaks
Copy link
Contributor

@swift-ci please nominate

Description: Fixes a regression with access level checking from recent work on generic typealiases in the 4.2 branch.

Scope of the issue: Code that was correctly rejected in 4.1 was being accepted, which could cause linker errors if someone tried to rely on the incorrect behavior.

Origination: Slava noticed this by inspection while working on other changes.

Risk: Low, it's a simple change.

Tested: New test added.

Reviewed by: @DougGregor or @jrose-apple

Radar: rdar://problem/40188409.

@AnnaZaks AnnaZaks merged commit f2536c2 into swiftlang:swift-4.2-branch-04-30-2018 May 14, 2018
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.

5 participants