This PR contains changes that ensure the following:
* Global accessor linkage is kept hidden if its decl is resilient.
- LinkageLimit::Never is returned for Global Accessor if its decl is resilient.
- Since it's kept hidden, the use site should not expect a call to a global accessor
if the static var decl being accessed is resilient. The bypassing resilience logic
in AbstractStorageDecl::isResilient(accessingModule, decl) has been removed; to be
addressed in Package CMO optimization pass.
* sil_global linkage is kept private if its decl is resilient.
Resolves rdar://129829925
Surprisingly, there are some situations where an extension can end up
with _fewer_ constraints than the extended type. That was baked-in as an
assertion in this new-ish method.
I haven't figured out why that can happen in the reproducer only when
using `-interpret` mode. It didn't trigger the assertion for me when
compiling normally.
The fix is simple: check all the requirements, rather than using a
short-cut.
resolves rdar://125659789 / https://github.com/apple/swift/issues/72719
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
Back of slightly on when we treat a "let" instance property as immutable
within an initializer, to deal with two newly-introduced source
incompatibilities.
Fixes rdar://129253556.
The computation that determined whether an access to a `let` instance
property within a constructor should be an initialization conflated the
cases of "we don't have a base expression" and "the base expression is
not something that could be `self`", and incorrectly identified rvalue
bases as being "initializable". Make the interface properly separate
out these cases, so we don't turn an lvalue into an rvalue access.
Fixes rdar://128661833.
This makes sure we don't apply logic that is specific to C++ reference types to Objective-C types.
Previously we were mistakenly treating some Objective-C types as foreign reference types. This meant that IRGen would try to emit calls to custom lifetime operations. This should not happen for non-C++ types.
rdar://128447046
Add global accessors to symbol list if VarDecl is fragile, i.e.
is non-resilient or its defining module allows non-resilient
access.
Don't set the class decl to hidden if it's in a package resilience
domain; even though its defining module is built resilently, the
class symbol should be visible across modules if they are in the
same package with resilience-bypass optimization. In such case,
treat its SubclassScope to Internal.
Resolves rdar://127321129
…for extensions. This change also removes @implementation(CategoryName); you should attach the category name to the @objc attribute instead. And there are small changes to how much checking the compiler will do on an @objc @implementation after the decl checker has discovered a problem with it.
A few things:
1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.
2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.
3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.
4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.
rdar://128216574
This functionality was previously reserved for ValueDecls. Move it all the way up to Decl; in the process, make it correctly handle EnumElementDecls and EnumCaseDecls.
This change also allows us to generalize `swift::fixDeclarationObjCName()` to work on extensions, though we do not use that capability in this commit.
This now specifies a category name that’s used in TBDGen, IRGen, and PrintAsClang. There are also now category name conflict diagnostics; these subsume some @implementation diagnostics.
(It turns out there was already a check for @objc(CustomName) to make sure it wasn’t a selector!)
Several offsetting bugs both broke the caching of `ObjCInterfaceAndImplementationRequest` and caused it to usually miss. Fix this whole painful mess. Also has collateral improvements to simple_display().
We still only parse transferring... but this sets us up for adding the new
'sending' syntax by first validating that this internal change does not mess up
the current transferring impl since we want both to keep working for now.
rdar://128216574
This operation determines whether a particular storage declaration,
when accessed from a particular location, is mutable or not. It has a
particular semantic that `let` declarations, when accessed from an
initializer, are considered mutable even though they can only be
assigned. There is similar logic for init accessors.
Tease apart "truly mutable" from "initializable because we're in an
initializer", introducing AbstractStorageDecl::mutability() to
represent all three states. isSettable() remains available as a thin
shim over mutability() and all clients are unchanged thus far, making
this a no-op refactoring.
This PR treats package access level as exportable, preventing
internally imported types from accidentally being declared in
package decl signatures.
Added package-specific cases to ExportabilityReason and
DisallowedOriginKind to track the validity of imported types
at use sites with package access scope. Added tests to cover
variety of use cases.
Resolves rdar://117586046&125050064&124484388&124306642
We now compute captures of functions and default arguments
lazily, instead of as a side effect of primary file checking.
Captures of closures are computed as part of the enclosing
context, not lazily, because the type checking of a single
closure body is not lazy.
This fixes a specific issue with the `-experimental-skip-*` flags,
where functions declared after a top-level `guard` statement are
considered to have local captures, but nothing was forcing these
captures to be computed.
Fixes rdar://problem/125981663.
Add the machinery to support suppression of inference of conformance to
protocols that would otherwise be derived automatically.
This commit does not enable any conformances to be suppressed.
This change introduces a new compilation target platform to the Swift compiler - visionOS.
- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.