-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Implement SE-0193 - part 1 #15594
Conversation
@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? |
@swift-ci Please test |
@swift-ci Please test source compatibility |
Build failed |
Build failed |
@swift-ci Please test source compatibility |
There was a problem hiding this 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!
include/swift/AST/Decl.h
Outdated
@@ -2244,12 +2245,12 @@ class ValueDecl : public Decl { | |||
/// | |||
/// \sa getFormalAccessScope | |||
AccessLevel getFormalAccess(const DeclContext *useDC = nullptr, | |||
bool respectVersionedAttr = false) const { | |||
bool respectUsableFromInline = false) const { |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
lib/Sema/TypeCheckAttr.cpp
Outdated
@@ -84,7 +84,7 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> { | |||
IGNORED_ATTR(ImplicitlyUnwrappedOptional) | |||
IGNORED_ATTR(Infix) | |||
IGNORED_ATTR(Inline) | |||
IGNORED_ATTR(Inlineable) | |||
IGNORED_ATTR(Inlinable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list is alphabetized.
There was a problem hiding this comment.
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!
lib/Sema/ResilienceDiagnostics.cpp
Outdated
diagnose(D, diag::resilience_decl_declared_here_versioned, | ||
D->getDescriptiveKind(), D->getFullName()); | ||
} | ||
diagnose(D, diag::resilience_decl_declared_here, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
I’ll fix the other comments and drop the default argument change for now. We can discuss it separately. |
…rsioned Just parse these as @inlinable and @versioned, then emit a warning (Swift 4.2 and below) or error (Swift 5).
@swift-ci Please smoke test |
This PR renames the attributes to their final names, but not does not yet add the change where
@inlinable
implies@usableFromInline
when applied to aninternal
declaration. I'd like to make that change in the next PR and test the renaming on its own.