Commit Graph

184973 Commits

Author SHA1 Message Date
Pavel Yaskevich
b1470321e8 Merge pull request #82430 from xedin/issue-82397
[CSSimplify] Prevent `missing call` fix from recording fixes while ma…
2025-06-24 09:12:33 -07:00
Michael Gottesman
2066826a3d Merge pull request #82421 from gottesmm/pr-0768c1bbd539bf7437d416ffb08cc970b9b96185
[region-isolation] Fix crash due to missing visitVectorBaseAddrInst case
2025-06-24 08:56:39 -07:00
Slava Pestov
be6669b3ec Merge pull request #82446 from slavapestov/fix-rdar152509409
AST: Tweak ConformanceLookupTable::compareConformances() some more
2025-06-24 11:47:21 -04:00
Alex Azarov
1b0c6bd7c9 Update tests 2025-06-24 17:32:11 +02:00
David Smith
08233afee9 Extend the existing memoization of NSString's Hashable conformance to cover AnyObjects that are actually NSStrings as well (#82440)
Fixes rdar://154123172 (Consider memoizing the lookup for NSString's
conformance to Hashable)
2025-06-24 08:21:13 -07:00
Saleem Abdulrasool
376ce05645 Merge pull request #82415 from compnerd/cmake-wiring
utils: adopt `SwiftCore_DIR` in new builds
2025-06-24 07:48:05 -07:00
Anthony Latsis
8e250f3edf Fix use-after-free through diagnostic argument 2025-06-24 15:42:44 +01:00
Erik Eckstein
0dbc63a00b Guard InlineArray addressors with feature flag
To be able to parse a recent Swift.swiftinterface file with a 6.2 compiler.
This is a follow-up fix for https://github.com/swiftlang/swift/pull/81441

rdar://154118968
2025-06-24 16:02:54 +02:00
Anthony Latsis
ad8c52237c Sema: Fix the insertion location for conformances attributes 2025-06-24 14:49:03 +01:00
Egor Zhdan
a292113ef2 [cxx-interop] Fix test failure on older macOS
The runtime logic for printing a foreign reference type is behind `if #available(SwiftStdlib 6.2, *)`, which means it won't run on older versions of macOS, even if you use a newer Swift runtime.

rdar://153735437
2025-06-24 13:36:22 +01:00
Charles Zablit
e8ea37b681 remove unused API 2025-06-24 13:03:32 +01:00
Alex Azarov
b72cda2cfb [Diagnostics] Fix typo in 'overridden' warning message and identifier 2025-06-24 13:41:36 +02:00
Alastair Houghton
cca0bf6c62 Merge pull request #82330 from al45tair/eng/PR-153615567
[Runtime][Tests] Disable Runtime/backtrace test on Android.
2025-06-24 10:22:22 +01:00
Andrew Trick
7c5d4b8b6d Fix MutableSpan exclusive access to unsafe pointers
This fix enables exclusive access to a MutableSpan created from an UnsafeMutablePointer.

The compiler has a special case that allows MutableSpan to depend on a mutable
pointer *without* extending that pointer's access scope. That lets us implement
standard library code like this:

    mutating public func extracting(droppingLast k: Int) -> Self {
      //...
      let newSpan = unsafe Self(_unchecked: _pointer, byteCount: newCount)
      return unsafe _overrideLifetime(newSpan, mutating: &self)

Refine this special case so that is does not apply to inout parameters where the
programmer has an expectation that the unsafe pointer is not copied when being
passed as an argument. Now, we safely get an exclusivity violation when creating
two mutable spans from the same pointer field:

    @lifetime(&self)
    mutating func getSpan() -> MutableSpan<T> {
      let span1 = makeMutableSpan(&self.pointer)
      let span2 = makeMutableSpan(&self.pointer) // ERROR: overlapping access
      return span1
    }

If we don't fix this now, it will likely be source breaking in the future.

Fixes rdar://153745332 (Swift allows constructing two MutableSpans to the same underlying pointer)
2025-06-24 00:10:06 -07:00
Konrad `ktoso` Malawski
a28515ec7e Merge pull request #82372 from ktoso/wip-NeverErrorTaskShouldNotThrowInOperation 2025-06-24 15:35:43 +09:00
Meghana Gupta
86bdca5bf4 Merge pull request #82354 from meg-gupta/lifetimeenum
Add lifetime dependencies on function types representing ~Escapable enum elements with ~Escapable payloads
2025-06-23 22:07:38 -07:00
Slava Pestov
8d30df5327 AST: Tweak ConformanceLookupTable::compareConformances() some more
If two conformances imply a conformance to the same marker
protocol, don't diagnose redundancy if they differ by
unavailability. Instead, allow the more available conformance
to win.

This allows declaring a type that conforms to a protocol
that inherits from SendableMetatype, followed by an
unavailable Sendable conformance on the same type.

Fixes rdar://152509409.
2025-06-23 22:54:18 -04:00
Saleem Abdulrasool
d0b34c2b67 Merge pull request #82170 from compnerd/internalise
IRGen: internalise well known types with static linking
2025-06-23 19:31:22 -07:00
Doug Gregor
0e3da0e499 Allow '@unsafe' on import declarations to silence '@preconcurrency' warning
'@preconcurrency' imports open up memory safety holes with respect to
Sendable, which are diagnosed under strict memory safety + strict
concurrency checking. Allow one to write '@unsafe' on those imports to
silence the diagnostic about it.
2025-06-23 19:06:14 -07:00
Guillaume Lessard
0473190189 [stdlib] adjust small string for contiguity 2025-06-23 18:38:33 -07:00
Guillaume Lessard
044e53f3b2 [test] adjust String span tests 2025-06-23 18:38:33 -07:00
Guillaume Lessard
3aad241019 [stdlib] address 32-bit watchOS ABI issue 2025-06-23 18:31:16 -07:00
Doug Gregor
dbf7fe6aa0 Merge pull request #82426 from DougGregor/selector-objc-async
Allow #selector to reference async method in non-async code
2025-06-24 02:33:00 +02:00
Meghana Gupta
0eb32f6943 Fixes after merge conflict 2025-06-23 16:52:18 -07:00
Daniil Kovalev
644f364d3d [AutoDiff] Use LinkEntity::SecondaryPointer for diff witness (#82412)
If `LinkEntity::isTypeKind()` is true, `IRGenModule::getAddrOfLLVMVariable` assumes that we can safely call
`LinkEntity::getType()`, which does `reinterpret_cast` of `LinkEntity::Pointer` to `TypeBase *`. However, for SIL
differentiability witness, the pointer has `SILDifferentiabilityWitness *` type, which is not derived from `TypeBase`. So, such a cast is not allowed.

Just as with `ProtocolWitnessTableLazyAccessFunction` and `ProtocolWitnessTableLazyCacheVariable` link entity kinds (which are also type kinds), we should use `SecondaryPointer` instead of `Pointer` for storing payload here, while setting `Pointer` to `nullptr`.
2025-06-23 16:18:07 -07:00
Allan Shortlidge
897a74f495 Tests: Move some availability tests into a new test/Availability directory.
Un-reverts 9c01ee2c1b.

Also, add myself as a reviewer for more availability related files.

NFC.
2025-06-23 15:57:34 -07:00
Allan Shortlidge
39b6c608b0 SILGen: Reorganize code related to availability.
NFC.
2025-06-23 15:57:34 -07:00
Allan Shortlidge
91043271fa SILGen: Rename SILGenBackDeploy.cpp to SILGenAvailability.cpp.
NFC.
2025-06-23 15:57:34 -07:00
Allan Shortlidge
05b13496fc Tests: Expand SILGen tests for custom availability domain queries. 2025-06-23 15:57:34 -07:00
Konrad `ktoso` Malawski
1e47e68512 Update startImmediatelyIsolation.swift 2025-06-24 07:21:48 +09:00
Adrian Prantl
31a9b798bb Merge pull request #82356 from adrian-prantl/catchall
[reflection] Fine-tune error messages
2025-06-23 15:13:10 -07:00
Evan Wilde
7f3fdb322d Merge pull request #82355 from etcwilde/ewilde/fbsd-cxx-interop-runtime
FreeBSD: Link C++ runtimes when Cxx interop is enabled
2025-06-23 14:21:02 -07:00
Evan Wilde
90eed66da0 FreeBSD: Set sourcekitInProc rpaths
The sourcekit in proc dynamic library looks up runtimes in a spot
relative to the Swift compiler. Set this location on freebsd, fixing the
sourcekit tests.
2025-06-23 14:16:14 -07:00
Meghana Gupta
2a2deea77b Avoid circular reference errors by adding an early bailout for imported enums 2025-06-23 13:42:55 -07:00
Meghana Gupta
adceb7abc3 Serialize/deserialize lifetime dependencies on enum elements 2025-06-23 13:42:54 -07:00
Meghana Gupta
7a6078cba7 [NFC] Add tests 2025-06-23 13:42:54 -07:00
Meghana Gupta
db24b6f758 Support lifetime dependence inference on enum elements 2025-06-23 13:42:53 -07:00
Meghana Gupta
ccda38b513 [NFC] Prepare LifetimeDependenceInfo to hold EnumElementDecl* 2025-06-23 13:42:48 -07:00
Artem Chikin
39c096c388 [Dependency Scanning] Refactor 'ModuleDependenciesCache' to not hold a reference to the global 'SwiftDependencyScanningService'
While this made sense in the distant past where the scanning service provided backing storage for the dependency cache, it no longer does so and now makes for awkard layering where clients get at the service via the cache. Now the cache is a simple data structure while all the clients that need access to the scanning service will get it explicitly.
2025-06-23 13:39:43 -07:00
Artem Chikin
68883a1014 [Dependency Scanning] Refactor Swift Scanner loader to be standalone
- 'SwiftModuleScanner' will now be owned directly by the 'ModuleDependencyScanningWorker' and will contain all the necessary custom logic, instead of being instantiated by the module interface loader for each query
- Moves ownership over module output path and sdk module output path directly into the scanning worker, instead of the cache
2025-06-23 13:39:36 -07:00
Pavel Yaskevich
7ecb1fd1db [CSSimplify] Prevent missing call fix from recording fixes while matching types
We need to be very careful while matching types to test whether a
fix is applicable or not to avoid adding extraneous fixes and failing
the path early. This is a temporary workaround, the real fix would
be to let `matchTypes` to propagate `TMF_ApplyingFixes` down.

Resolves: rdar://154010220
Resolves: https://github.com/swiftlang/swift/issues/82397
2025-06-23 13:38:38 -07:00
Pavel Yaskevich
25585c07f3 Merge pull request #82386 from xedin/rdar-153922620
[Concurrency] References to `nonisolated(nonsending)` properties don't…
2025-06-23 13:38:09 -07:00
Saleem Abdulrasool
7d1ddccbf5 Merge pull request #82416 from compnerd/android-failures
Runtimes: adjust for incorrect Android behaviour
2025-06-23 13:30:07 -07:00
Egor Zhdan
e232273886 Merge pull request #82413 from swiftlang/egorzhdan/namespace-printer-null-crash
[cxx-interop] Fix printing of namespaces declared in bridging headers
2025-06-23 21:07:36 +01:00
Doug Gregor
c34f81e110 Allow #selector to reference async method in non-async code
Fixes rdar://153118331
2025-06-23 12:41:18 -07:00
Egor Zhdan
c6d9b846b6 Merge pull request #82411 from swiftlang/egorzhdan/dead-code
[cxx-interop] NFC: Remove unused function
2025-06-23 20:14:12 +01:00
Dario Rexin
e802a4c104 [Test] Disable IRGen/generic_tuples.swift on arm64e
rdar://153961233

This test will fail on arm64e targets, because ptrauth is not handled.
2025-06-23 11:47:41 -07:00
stzn
660263cf2c [region-isolation] Fix crash due to missing visitVectorBaseAddrInst case
Credit to https://github.com/stzn for initial work on the patch.

rdar://151401230
2025-06-23 11:11:59 -07:00
Alastair Houghton
a1daea92ed [Build][Concurrency] Update new runtime build as well.
We need to update the new runtime build with the filename change also.

rdar://153531418
2025-06-23 18:31:05 +01:00
Steven Wu
7d10bcafd9 [TEST-ONLY][Caching] Don't assume pluginCAS can be shared with builtinCAS
Don't assume the `-cas-path` option can be shared between builtin CAS
and plugin CAS. This can lead to test failures when pluginCAS doesn't
use the same storage schema as builtin CAS.
2025-06-23 09:57:50 -07:00