Skip to content

Implement SE-0193 - part 1 #15594

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 5 commits into from
Mar 31, 2018
Merged

Implement SE-0193 - part 1 #15594

merged 5 commits into from
Mar 31, 2018

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Mar 29, 2018

This PR renames the attributes to their final names, but not does not yet add the change where @inlinable implies @usableFromInline when applied to an internal declaration. I'd like to make that change in the next PR and test the renaming on its own.

@slavapestov
Copy link
Contributor Author

@airspeedswift @milseman @lorentey @lancep Just a heads-up that I'm planning on landing this shortly, and it touches a lot of stdlib files. Do you have any big changes in flight I should wait for?

@slavapestov slavapestov changed the title [WIP] Implement SE-0193 Implement SE-0193 - part 1 Mar 30, 2018
@slavapestov slavapestov requested a review from jrose-apple March 30, 2018 01:46
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e96e819de3513ee993b99628059d77c9b383e11e

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e96e819de3513ee993b99628059d77c9b383e11e

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

No big changes coming on my end, but one of the commits in here is not a change we want!

@@ -2244,12 +2245,12 @@ class ValueDecl : public Decl {
///
/// \sa getFormalAccessScope
AccessLevel getFormalAccess(const DeclContext *useDC = nullptr,
bool respectVersionedAttr = false) const {
bool respectUsableFromInline = false) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

This flag no longer makes sense. Hm. Maybe an explicit "treatUsageFromInlineAsPublic"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isUsageFromInline? It’s kind of weird isn’t it

lib/AST/Decl.cpp Outdated
/// at the SIL, LLVM, and machine levels due to being versioned.
bool ValueDecl::isVersionedInternalDecl() const {
/// at the SIL, LLVM, and machine levels due to being @usableFromInline.
bool ValueDecl::isUsableFromInlineDecl() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: This probably doesn't need Decl on the end anymore.

@@ -84,7 +84,7 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> {
IGNORED_ATTR(ImplicitlyUnwrappedOptional)
IGNORED_ATTR(Infix)
IGNORED_ATTR(Inline)
IGNORED_ATTR(Inlineable)
IGNORED_ATTR(Inlinable)
Copy link
Contributor

Choose a reason for hiding this comment

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

This list is alphabetized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took me a while to understand why it wasn't alphabetized any more... now I see it. Hah!

diagnose(D, diag::resilience_decl_declared_here_versioned,
D->getDescriptiveKind(), D->getFullName());
}
diagnose(D, diag::resilience_decl_declared_here,
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is incorrect; default arguments must only reference true-public things because we want to print that in generated interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change only affects the wording in the diagnostic - you could already reference usableFromInline things. We don’t serialize Exprs so there’s nothing to print, and a common complaint when we rolled out the default argument change was people wanted to reference non-public things. What do you think?

@slavapestov
Copy link
Contributor Author

I’ll fix the other comments and drop the default argument change for now. We can discuss it separately.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

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