Commit Graph

1342 Commits

Author SHA1 Message Date
swift-ci
da71db97c3 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-12 17:35:31 -07:00
Alex Hoppen
7d7eb6e61d [Sema/IDE] Emit same diagnostics for missing switch cases independent of editor mode 2024-08-12 14:01:22 -07:00
Ben Barham
df81d0a450 [Tests] XFAIL the remaining test failures on rebranch
Only a few tests remaining. XFAIL so we can test the rest of the
toolchain.
2024-08-08 14:47:18 -07:00
swift-ci
6172e1dc44 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-07 17:34:15 -07:00
Alex Hoppen
8edb57c756 Merge pull request #75667 from ahoppen/build-issues-live-issues
[Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
2024-08-07 17:24:47 -07:00
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
swift-ci
0ea08ed45e Merge remote-tracking branch 'origin/main' into rebranch 2024-08-07 10:35:14 -07:00
Holly Borla
0d5e59882a [Concurrency] Implement a narrow carve out in the isolation
override checking for `NSObject.init()`

Overriding `NSObject.init()` within a `@MainActor`-isolated type
is difficult-to-impossible, especially if you need to call an initializer
from an intermediate superclass that is also `@MainActor`-isolated.
This won't admit a runtime data-race safety hole, because dynamic
isolation checks will be inserted in the @objc thunks under
`DynamicActorIsolation`, and direct calls will enforce `@MainActor`
as usual.
2024-08-06 23:08:35 -07:00
Ben Barham
7bdf1e117e Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp` not positive
    what the cause here was, just took main.
2024-08-06 13:44:27 -07:00
Holly Borla
bd1653e497 [Concurrency] Split up the non-Sendable result diagnostics and improve
wording.
2024-08-05 09:56:11 -07:00
swift-ci
2b0b954400 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-31 14:34:32 -07:00
Holly Borla
d40663dd66 [Concurrency] Flip the implicitly async select in a concurrency error.
This diagnostic was presenting "implicitly async" for explicitly async calls,
and vice versa, because the `select` was incorrect.
2024-07-31 06:46:07 -07:00
Becca Royal-Gordon
6902b7e8ff Fix ClangImporter/CoreGraphics_test.swift
In rebranch, the IR for the function includes a new `range` attribute. Loosen the FileCheck pattern to accommodate it.

Fixes rdar://127262497.
2024-07-24 17:36:13 -07:00
Becca Royal-Gordon
d2184688aa Fix ClangImporter/const_and_pure.swift
In the rebranch compiler, `void` functions cannot be const or pure.

Fixes rdar://127262449.
2024-07-24 13:07:13 -07:00
swift-ci
f1ea924a51 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 10:14:18 -07:00
Allan Shortlidge
eb16025f56 Tests: Upstream some miscellaneous macCatalyst tests. 2024-07-23 17:00:10 -07:00
Felipe de Azevedo Piovezan
a321b0afe0 [DebugInfo] Update tests to expect new LLVM debug format 2024-07-23 11:06:12 -07:00
Pavel Yaskevich
f7d3230535 [Concurrency] Fix disallowed override isolation to carry @preconcurrency bit
If ObjC member cannot be overridden due to isolation mismatch set `@preconcurrency`
bit to make the diagnostic a warning instead of an error in Swift 5 mode.

Resolves: rdar://130776220
2024-07-09 13:34:17 -07:00
Michael Gottesman
34195ff213 Merge pull request #74610 from gottesmm/pr-324fd70c13e87a329334341aae4667f2d1be152c
[sending] Remove transferring.
2024-07-02 14:02:18 -07:00
Michael Gottesman
474aa47732 [concurrency] Standardize sending of non-isolated -> nonisolated to match the keyword 'nonisolated'.
rdar://130827967
2024-06-29 18:09:38 -07:00
Michael Gottesman
112071e57d [sending] Remove transferring.
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
2024-06-21 16:03:21 -07:00
Pavel Yaskevich
4cc69b85d6 [ClangImporter] Always add AnyObject constraint to generic parameters
`: AnyObject` was added only if there were no other constraints because
all of them would imply it before, with introduction of `Sendable` this
is no longer the case. Let's add `AnyObject` constraint unconditionally
and let generic signature builder deal with the redundancy.

Resolves: rdar://127520993
2024-06-17 12:17:18 -07:00
Holly Borla
128a8bc942 [Concurrency] Don't ignore mismatching isolation for overrides of
Clang-imported superclass methods.
2024-06-08 16:58:30 -07:00
Alex Lorenz
5aa63fc93e Merge pull request #72634 from hyp/eng/android/ndk-overlay
[android] add an Android NDK Swift overlay
2024-06-05 19:35:13 -07:00
Michael Gottesman
88729b9e34 [sending] Make {Transferring,Sending}ArgsAndResults a LANGUAGE_FEATURE instead of an UPCOMING_FEATURE.
TLDR: This makes it so that we always can parse sending/transferring but changes
the semantic language effects to be keyed on RegionBasedIsolation instead.

----

The key thing that makes this all work is that I changed all of the "special"
semantic changes originally triggered on *ArgsAndResults to now be triggered
based on RegionBasedIsolation being enabled. This makes a lot of sense since we
want these semantic changes specifically to be combined with the checkers that
RegionBasedIsolation turns on. As a result, even though this causes these two
features to always be enabled, we just parse it but we do not use it for
anything semantically.

rdar://128961672
2024-06-01 23:25:16 -07:00
Alex Lorenz
0f9a69c712 android test fixes 2024-05-28 12:59:26 -07:00
Becca Royal-Gordon
d9912009b0 Merge pull request #73309 from beccadax/objcimpl-category-on-objc 2024-05-21 10:19:14 -07:00
Becca Royal-Gordon
9db14c36ad Require @objc to be used with @implementation
…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.
2024-05-17 14:57:32 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
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
2024-05-16 21:43:50 -07:00
Michael Gottesman
71e95b9527 [sending] Change transferring diagnostics to say sending instead of transferring.
Just trying to slice off a larger change where I change these tests to actually
use 'sending'. This is nice to do now since it is algebraic to do.

rdar://128216574
2024-05-16 20:35:34 -07:00
Holly Borla
29b8e6e6b0 [Concurrency] Un-gate implicit nonisolated access to struct vars and isolated
subclassing.

These features are additive, and they don't need to be gated behind the
`GlobalActorIsolatedTypesUsability` upcoming feature. The other inference
changes, including `@Sendable` inference for global-actor-isolated function
types, and global-actor inference on protocol refinements, remain gated
behind the upcoming flag.
2024-05-14 11:43:25 -07:00
Andrew Trick
c112e03a32 Fix initialization of imported ObjC block types.
This fixes a SIL ownership verification error when importing structs like:

typedef bool (^boolBlock)(void);

struct objc_bool_block {
  __unsafe_unretained boolBlock block;
};

Fixes rdar://126142109 (Found an operand with a value that is not compatible
with the operand's operand ownership kind map)
2024-05-10 17:45:11 -07:00
Holly Borla
e7db0ec8f8 Merge pull request #73472 from hborla/exhaustive-switch-error
[Sema] Non-exhaustive switch statements are always an error in Swift 6.
2024-05-07 09:03:40 -07:00
Holly Borla
910bc35e85 [Sema] Non-exhaustive switch statements are always an error in Swift 6. 2024-05-06 20:56:20 -07:00
Michael Gottesman
f64f2529fb [region-isolation] Some more diagnostic wordsmithing.
rdar://127580781
2024-05-06 19:20:07 -07:00
Michael Gottesman
e4db879112 [region-isolation] Some more diagnostic wordsmithing.
rdar://127580781
2024-05-06 12:09:10 -07:00
Michael Gottesman
266432cf20 Fixes for clang importer tests that I missed 2024-05-05 18:01:05 -07:00
Michael Gottesman
f02172a323 [region-isolation] Change terminology to use the term 'risk' instead of could. 2024-05-05 18:01:05 -07:00
Michael Gottesman
699692bd39 [region-isolation] Change diagnostics from using the term transferring -> sending.
rdar://127580781
2024-05-05 18:00:54 -07:00
Michael Gottesman
bfa910dcb1 Merge pull request #72959 from gottesmm/tns-upstream-2
[region-isolation] Do not look through begin_borrow or move_value if they are marked as a var_decl.
2024-04-17 17:42:19 -07:00
Pavel Yaskevich
7b8f76e3c4 Merge pull request #73007 from xedin/promote-dynamic-actor-isolation-to-upcoming-feature
[SE-0423] Promote `DynamicActorIsolation` to an upcoming feature and add a way to disable checks
2024-04-16 11:46:41 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Pavel Yaskevich
72eb8abadb [Sema/SILGen] Don't emit dynamic actor isolation checks when -disable-dynamic-actor-isolation flag is used 2024-04-15 09:19:22 -07:00
Pavel Yaskevich
03e9d4258e [Frontend] NFC: Promote DynamicActorIsolation to an upcoming feature flag 2024-04-14 21:28:13 -07:00
Michael Gottesman
eed51e7528 [region-isolation] Make load/load_borrow look through instructions.
This ensures that when we process, we consider load/load_borrow's result to be
equivalent to its operand. This ensures that a load/load_borrow cannot act as a
use of its operand preventing spurious diagnostics.
2024-04-11 15:41:18 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
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.
2024-04-10 09:38:02 -07:00
Allan Shortlidge
5bdd952792 Tests: More test coverage in objc_async_conformance.swift
Add regression tests for rdar://125945942.
2024-04-09 15:20:18 -07:00
Allan Shortlidge
8a27b681b0 Tests: Increase test coverage in objc_async_conformance.swift.
Add regression tests for rdar://125935350.
2024-04-09 15:20:18 -07:00
Michael Gottesman
a56d0f5ded [region-isolation] Tweak the main transferring diagnostic.
Specifically, I am transforming it from "may cause a race" -> "may cause a data
race". Adding data is a small thing, but it adds a bunch of nice clarity.
2024-04-06 22:50:26 -07:00
Becca Royal-Gordon
3990e17ae3 Merge pull request #71938 from beccadax/objcimpl-redundant-conformance-class-ext
Fix class extension visibility bug
2024-03-29 20:15:46 -07:00