Replace the existing C++ implementation of extractInlinableText with
a new implementation based on swift-syntax. It uses SwiftIfConfig to
remove inactive regions (with a special mode), and a new compiler-only
entrypoint in the library to remove comments and `#sourceLocation`.
Allow any declaration to be marked with `@unsafe`, meaning that it
involves unsafe code. This also extends to C declarations marked with
the `swift_attr("unsafe")` attribute.
Under a separate experimental flag (`DisallowUnsafe`), diagnose any
attempt to use an `@unsafe` declaration or any unsafe language feature
(such as `unowned(unsafe)`, `@unchecked Sendable`). This begins to
define a "safe" mode in Swift that prohibits memory-unsafe constructs.
In this PR i worked on replacing the word accessor in diagnostics with more user-facing terminologies like setter, getter, didSet Observer, and members based on the context of the message.
in some messages i didn't need to pass DescriptiveDeclKind instead i just changed the text copy itself.
i also updated tests, so you might find it easier to check my changes this way.
Please let me know if there's something i should've done in a better way, and request changes if needed. !
i can squash my commits after reviewing getting the PR Reviewed, just to make it easier to be checked commit by commit
Resolves#55887
`@unknown default` in switch statements are required for resilient enums since they
might be modified with new fields in the future and modules defining the enums are
generally not built together with the consuming modules.
However, if the modules are in the same package, they are required to be built together,
thus the requirement for `@unknown default` can be skipped. This PR removes the need for
that, enabling less boilerplate. Note this change only impacts typecheck and not SIL gen.
Resolves rdar://130015149.
Upstreams the necessary changes to compile references to `@backDeployed`
declarations correctly when a `macabi` target triple or a `-target-variant` is
specified.
Out of an abundance of caution, we:
1. Left in parsing support for transferring but internally made it rely on the
internals of sending.
2. Added a warning to tell people that transferring was going to
be removed very soon.
Now that we have given people some time, remove support for parsing
transferring.
rdar://130253724
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.