Commit Graph

184973 Commits

Author SHA1 Message Date
Alastair Houghton
a5b14d747f [Tests][Concurrency] Turn off async_taskgroup test for back-deployment.
We don't want to run this test when back-deploying.

rdar://151975988
2025-06-12 18:30:42 +01:00
Pavel Yaskevich
5e17762b22 Merge pull request #82173 from xedin/rdar-152687353
[Concurrency] NonisolatedNonsendingByDefault: Migration applies only to the current module declarations
2025-06-12 10:18:59 -07:00
John Hui
8aca536b97 [NFC] Use ASSERT() and silence unused variable warning
Comments in PR #80438, where this code comes from, already suggest using
ASSERT() instead of assert().
2025-06-12 09:57:25 -07:00
Hamish Knight
db49faf167 [Sema] Avoid solver-allocated original ErrorTypes in transformDependentMemberType
`substBase` here can contain type variables or placeholders, avoid
using them as the original ErrorTypes since ErrorTypes cannot be
solver-allocated currently. This only affects type printing so
shouldn't matter much.
2025-06-12 17:54:59 +01:00
Stephen Canon
9259c3eec4 Add new interleave and deinterleave builtins (#81689)
Ideally we'd be able to use the llvm interleave2 and deinterleave2
intrinsics instead of adding these, but deinterleave currently isn't
available from Swift, and even if you hack that in, the codegen from
LLVM is worse than what shufflevector produces for both x86 and arm. So
in the medium-term we'll use these builtins, and hope to remove them in
favor of [de]interleave2 at some future point.
2025-06-12 12:01:53 -04:00
Pavel Yaskevich
bbe1185d85 Merge pull request #82157 from xedin/rdar-143581268
[TypeChecker] Remove `@_inheritActorContext` effect from synchronous …
2025-06-12 08:34:58 -07:00
Artem Chikin
a78ee29692 [Dependency Scanning] Remove obsolete placeholder module concept
This was used a long time ago for a design of a scanner which could rely on the client to specify that some modules *will be* present at a given location but are not yet during the scan. We have long ago determined that the scanner must have all modules available to it at the time of scan for soundness. This code has been stale for a couple of years and it is time to simplify things a bit by deleting it.
2025-06-12 08:32:25 -07:00
Slava Pestov
72401cabdb Merge pull request #82129 from slavapestov/bind-extensions-macro
Sema: Don't expand macros when binding extensions
2025-06-12 10:33:56 -04:00
Artem Chikin
c3ce91e071 [Dependency Scanning] Add libSwiftScan API and JSON output for source import information 2025-06-12 06:56:33 -07:00
Artem Chikin
6816922dd4 [Dependency Scanning] Keep track of each imported module's access control
Adds an access control field for each imported module identified. When multiple imports of the same module are found, this keeps track of the most "open" access specifier.
2025-06-12 06:56:30 -07:00
Stephen Canon
c24bae70e8 Fixup Observations availability from 9999 to 6.2 (#82198) 2025-06-12 09:10:24 -04:00
Guillaume Lessard
3b9ec94f20 Merge pull request #82102 from valeriyvan/span
Fix parameter, doc comments in Span family
2025-06-12 04:41:50 -07:00
Hamish Knight
6d0da8d5cc [CS] Avoid solver-allocated inputs with typesSatisfyConstraint
Escaping solver-allocated types into a nested allocation arena is
problematic since we can e.g lazily compute the `ContextSubMap` for a
`NominalOrBoundGenericNominalType`, which is then destroyed when we
exit the nested arena. Ensure we don't pass any types with type
variables or placeholders to `typesSatisfyConstraint`.

rdar://152763265
2025-06-12 12:11:19 +01:00
Hamish Knight
215d63923b [AST] Enforce we don't get solver-allocated ErrorTypes
I don't believe we ever form these types, and if we did we aren't
correctly handling them in `Solution::simplifyType`. Let's just
enforce we don't get them.
2025-06-12 12:11:19 +01:00
Hamish Knight
080b3fa55f [CS] Remove UnresolvedType ranking logic
We should never end up here, we should have placeholder bindings
instead for holes.
2025-06-12 12:11:19 +01:00
Hamish Knight
71d20b7635 [CS] NFC: Remove FreeTypeVariableBinding::UnresolvedType
This is now unused.
2025-06-12 12:11:19 +01:00
Alastair Houghton
69a2011f4f [Concurrency] Fix null pointer dereference for task-to-thread model.
In task-to-thread concurrency mode, `_getMainExecutorAsSerialExecutor`
returns `SerialExecutorRef::generic()`, which is, give or take, NULL.
Unfortunately we'd declared it as returning `any SerialExecutor`,
rather than `(any SerialExecutor)?`, and then the `getMainExecutor()`
function was calling `asUnownedSerialExecutor()` on it, which then
crashes.

rdar://153152063
2025-06-12 11:36:16 +01:00
Hamish Knight
a0b05904b3 [AST] Delete copy constructor for LoadedExecutablePlugin::PluginProcess
Avoid a potential footgun here since copying would lead to waiting
for the child process multiple times.
2025-06-12 11:33:52 +01:00
Meghana Gupta
8396a6d8c0 Fix an inliner crash when inlining begin_apply with scoped lifetime dependence
LifetimeDependenceInsertion inserts mark_dependence on token result of a begin_apply
when it yields a lifetime dependent value. When such a begin_apply gets inlined,
the inliner can crash because of the remaining uses of the token result.

Fix this by inserting mark_dependence on parameter operands that are lifetime dependence sources
and deleting the mark_dependence on token results in the inliner.

Fixes rdar://151568816
2025-06-12 01:35:36 -07:00
Dan Blackwell
665515c781 Merge pull request #82158 from swiftlang/tsan-release-fix
[concurrency] Move tsan_release to point before task gets destroyed
swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a
2025-06-12 08:26:49 +01:00
Pavel Yaskevich
ab227b401d [ClangImporter] SE-0463: Implement @Sendable inference exception for global actor isolated functions
Functions that are isolated to a global actor don't have completion
handlers imported as `@Sendable`. Main actor isolated functions with
completion handlers that are always called on the main actor is a
very common Objective-C pattern, and this carve out will eliminate
false positive warnings in the cases where the main actor annotation
is missing on the completion handler parameter.

Resolves: rdar://149811049
2025-06-11 23:44:01 -07:00
Konrad `ktoso` Malawski
01f911a36b Merge pull request #82179 from ktoso/wip-fix-incorrect-memory-effects-on-task-create 2025-06-12 13:42:32 +09:00
eeckstein
116a453556 Merge pull request #82177 from eeckstein/fix-lha
LowerHopToActor: insert a borrow scope for an `Optional<Actor>.none` value
2025-06-12 06:16:45 +02:00
Allan Shortlidge
16a6536285 Merge pull request #82187 from tshortli/warnings
Address some warnings
2025-06-11 18:43:01 -07:00
Artem Chikin
a35c112a70 Merge pull request #81919 from artemcm/DiagnoseMissingModulesSeenInSerializedSearchPaths
[Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
2025-06-11 18:00:01 -07:00
Slava Pestov
63a5731da1 Sema: Try to bind extensions without expanding macros
Macro expansion can call typeCheckExpr(), which performs qualified
lookups. So if we expand macros while binding extensions, these
qualified lookups can fail because they cannot find members of
extensions that have not been bound yet.

To fix this, try binding extensions without performing macro
expansion first. If any extensions remain at the end, we fall back
to the old behavior, and try to bind them again, this time
performing macro expansion.

Fixes rdar://149798059.
2025-06-11 20:07:43 -04:00
Slava Pestov
d4280d4f98 AST: Add excludeMacroExpansions parameter to computeExtendedNominal() 2025-06-11 20:07:42 -04:00
Slava Pestov
71186eb07f AST: Call setExtendedNominal() instead of cacheOutput(ExtendedNominalRequest...) 2025-06-11 20:07:42 -04:00
Yuta Saito
df9bed6a29 [wasm] Enable building swift-testing for wasm32-unknown-wasip1-threads 2025-06-12 07:57:40 +09:00
Eric Miotto
b7f8eb7480 build-script: Remove support for legacy way of building compiler-rt
Addresses rdar://149293315
2025-06-11 14:39:05 -07:00
Michael Gottesman
e95b8570d6 Merge pull request #82149 from gottesmm/pr-4cb0aff1ceb16d75edcadd4de2ed612b97924226
Change send-never-sendable of isolated partial applies to use SIL level info instead of AST info.
2025-06-11 13:52:43 -07:00
Andrew Trick
f6c7524353 Update tests after disallowing @_lifetime(borrow) for inout 2025-06-11 13:45:00 -07:00
Allan Shortlidge
71eede247f StdlibUnittest: Use @_lifetime instead of @lifetime.
Resolves a warning.
2025-06-11 12:49:43 -07:00
Henrik G. Olsson
00afb8ba81 Merge pull request #82076 from hnrklssn/skip-bounds-safety-types2
When instantiating templated functions with pointers to the templated type, the ClangImporter does not strip type sugar. This strips type sugar for bounds attributes, to make sure that they import the same regardless of whether they are parsed or not.

rdar://151041990
2025-06-11 21:44:31 +02:00
Andrew Trick
a38925493b Disallow @_lifetime(borrow) for trivial 'inout' arguments
@_lifetime(borrow holder) // ERROR
    func test(holder: inout Holder) -> NE

Fixes rdar://153040843 ([nonescapable] disallow @_lifetime(borrow)
for trivial 'inout' arguments)
2025-06-11 11:33:35 -07:00
Saleem Abdulrasool
7fa316c71d IRGen: internalise well known types with static linking
When statically linking the standard library ensure that we emit the
well known metadata and accessors with internal linkage. This fixes a
number of warnings about incorrect DLL storage when building Foundation
on Windows for static linking.
2025-06-11 11:23:21 -07:00
Andrew Trick
9dd88e277e [NFC] LifetimeDependence: fix indentation
To avoid diff/merge confusion.
2025-06-11 10:37:40 -07:00
Allan Shortlidge
2a11d03830 IDE: Resolve unused variable warnings in SourceEntityWalker.cpp. 2025-06-11 09:53:48 -07:00
Mohamed Hegazy
276261c2f3 Merge pull request #81644 from mhegazy/no-asserts-toolchain
[build.ps1] Revamp No-asserts toolchain build and packaging
2025-06-11 09:30:25 -07:00
finagolfin
2d735e8c39 [build] Switch over to new --cross-compile-build-swift-tools flag when cross-compiling Foundation macros (#82163)
Follow-on to #38441, missed this there.
2025-06-11 21:43:56 +05:30
Joe Groff
1869832929 Merge pull request #82153 from tshortli/rhombicuboctahedron
Upstream support for the Xcode 26 SDKs
2025-06-11 07:10:34 -07:00
Joe Groff
b3273f700c Merge branch 'main' into rhombicuboctahedron 2025-06-11 06:40:58 -07:00
Konrad 'ktoso' Malawski
3aa28b4de9 [Concurrency] Correct memory effect attributes of task_create
Without this, llvm would sometimes wrongly assume there's no indirect
accesses and the optimizations can lead to a runtime crash, by
optimizing away initializing options properly.

Resolves rdar://152548190
2025-06-11 22:03:52 +09:00
Erik Eckstein
5489627310 LowerHopToActor: insert a borrow scope for an Optional<Actor>.none value
An optional-none value has "none" ownership, but still a borrow scope is needed.
Fixes a SIL verifier crash.
rdar://153066034
2025-06-11 13:35:21 +02:00
Alastair Houghton
cc6389366c [IRGen] Don't use GOTPCREL relocations for x86 ELF.
Unforunately, x86 ELF linkers like to optimize GOTPCREL relocations by
replacing `mov` instructions that go via the GOT with `lea` instructions
that do not.

That would be fine, but they aren't very selective and will happily
perform this transformation in non-code sections if they think that
the bytes before a relocation look like a `mov` instruction.

This corrupts our metadata.

rdar://148168098
2025-06-11 12:03:38 +01:00
Susana Monteiro
6164af2f46 Merge pull request #81832 from swiftlang/susmonteiro/class-metadata-private-fields
[cxx-interop] Support for printing C++ foreign references
2025-06-11 11:58:45 +01:00
Hamish Knight
580f20efec Merge pull request #82150 from hamishknight/fixed-test
[test] Mark `8c2d6198e18a56a.swift` as fixed
2025-06-11 11:13:09 +01:00
Saleem Abdulrasool
6b3e2cdeed Merge pull request #82139 from mhegazy/fix_dsipatch_build_on_android
Add explicit cast to nsec in android platforms
2025-06-11 01:22:53 -07:00
Pavel Yaskevich
1457aecc87 [Tests/NFC] NonisolatedNonsendingByDefault: Rename adoption_mode.swift test into migration_mode.swift 2025-06-11 00:11:00 -07:00
Pavel Yaskevich
bcd6caaea4 [Concurrency] NonisolatedNonsendingByDefault: Migration applies only to the current module declarations
Prevent migration from handling declarations that come from a
module different from the current one, this is primarily a
problem for swiftinterfaces that can get rebuilt when the module
is imported by a model that has migration mode enabled.

Resolves: rdar://152687353
2025-06-11 00:06:38 -07:00