Commit Graph

184973 Commits

Author SHA1 Message Date
Slava Pestov
487918f07b Sema: Fix -warn-long-expression-type-checking when expression timer is turned off
My change 983b75e1cf broke
-warn-long-expression-type-checking because now the
ExpressionTimer is not instantiated by default and that
entire code path is skipped.

Change it so that if -warn-long-expression-type-checking
is passed in, we still start the timer, we just don't
ever consider it to have 'expired'.

Fixes rdar://problem/152998878.
2025-06-25 22:07:23 -04:00
Slava Pestov
84d1d115e1 Sema: Change -solver-memory-threshold into a frontend flag for consistency with the others 2025-06-25 22:07:23 -04:00
Slava Pestov
0f00c89b31 Sema: Remove unused variable 2025-06-25 22:07:23 -04:00
Slava Pestov
610887cdb4 Re-enable some tests that were disabled a long time ago 2025-06-25 22:07:23 -04:00
Andrew Trick
87f2510a27 Diagnostic note for invalid @_lifetime annotations on inout params
Users commonly try to write a lifetime dependency on an 'inout' parameters as:

    @_lifetime(a: &a)
    func f_inout_useless(a: inout MutableRawSpan) {}

This is useless. Guide them toward what they really wanted:

    @_lifetime(a: copy a)

Fixes rdar://151618856 (@lifetime(..) gives inconsistent error messages)
2025-06-25 16:34:43 -07:00
Andrew Trick
080b68292d Fix a compiler crash with '@'_lifetime(inout x), add diagnostic
This is a common mistake made more common be suggestions of existing diagnostic
that tell users not to use a 'copy' dependency.

Report a diagnostic error rather than crashing the compiler. Fix the diagnostic
output to make sense relative to the source location.

Fixes rdar://154136015 ([nonescapable] compiler assertion with @_lifetime(x: inout x))
2025-06-25 16:34:43 -07:00
Andrew Trick
05fa82b7a7 Fix misleading Lifetime diagnostics for inout parameters
Correctly diagnose this as:
"invalid use of inout dependence on the same inout parameter

    @_lifetime(a: &a)
    func f_inout_useless(a: inout MutableRawSpan) {}

Correctly diagnose this as:
"lifetime-dependent parameter must be 'inout'":

    @_lifetime(a: borrow a)
    func f_inout_useless(a: borrowing MutableRawSpan) {}
2025-06-25 16:34:43 -07:00
Andrew Trick
df0b81c88d Lifetime diagnostics: clarify @_lifetime usage for inout parameters
This comes up often when passing a MutableSpan as an 'inout' argument.  The
vague diagnostic was causing developers to attempt incorrect @_lifetime
annotations. Be clear about why the annotation is needed and which annotation
should be used.
2025-06-25 16:34:42 -07:00
Nate Chandler
c108d480ab [IRGen] Sign these function pointers.
Value witness tables for prespecialized metadata for multi payload enums
contain references to `swift_getMultiPayloadEnumTagSinglePayload` and
`swift_storeMultiPayloadEnumTagSinglePayload`.  On platforms with
ptrauth, those functions must be signed.  Use the same helper when
adding these functions to the table as is used to add every single other
function to the table.

rdar://80334865
2025-06-25 16:24:40 -07:00
Pavel Yaskevich
0999792bf4 Merge pull request #82467 from xedin/swift-testing-troubles
[CSSimplify] Narrow down tuple wrapping for pack expansion matching
2025-06-25 16:03:07 -07:00
Dave Lee
ce7a3b39a4 IRGen: Emit objc type encoding for ivars (#81967)
ObjC ivar metadata has up to now emitted an empty string for the ivar's objc type encoding. Conversely, ObjC property metadata is emitted with an objc type encoding. This changes the compiler to also emit an objc type encoding for ivars.

The motivation for this change is for lldb to print ivars of classes declared in Objective-C but implemented in Swift, as defined in [SE-0436](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0436-objc-implementation.md). Without the presence of type encoding for ivars, lldb is unable to present to the user the ivars/properties of instances of such classes.

rdar://138569299
2025-06-25 15:39:23 -07:00
Andrew Trick
465d6a82e7 Fix LifetimeDependence diagnostic formatting
Remove incorrectly nested single quotes from the suggested fix.
2025-06-25 15:24:12 -07:00
Alejandro Alonso
596b015994 Adjust ABI test and guard address of property 2025-06-25 14:08:53 -07:00
Dario Rexin
7d338f2ee0 Merge pull request #82423 from drexin/wip-153961233
[Test] Disable IRGen/generic_tuples.swift on arm64e
2025-06-25 14:05:23 -07:00
Alejandro Alonso
6953a7c6f9 Update InlineArray.swift 2025-06-25 14:00:16 -07:00
Alejandro Alonso
5ac3a655d4 Update InlineArray.swift 2025-06-25 14:00:15 -07:00
Alejandro Alonso
db13bf0802 Update InlineArray.swift 2025-06-25 14:00:14 -07:00
Alejandro Alonso
8058bd26f6 Remove underscored with buffer pointer APIs on InlineArray 2025-06-25 14:00:12 -07:00
Evan Wilde
12e784c3c8 Replace sftp_server with rsync
remote-run uses rsync instead of sftp server. Some of the tests were
incorrectly labelled as requiring sftp server. Fixed those and replaced
the requirement with rsync.
2025-06-25 13:39:01 -07:00
Evan Wilde
80863f0bf1 remote-run: Find rsync on path
The current remote-run implementation only works if rsync is located at
`/usr/bin/`, which isn't always the case. FreeBSD installs rsync to
`/usr/local/bin` as it is not installed in the base system by default.
Relax the script to accept rsync on any path.
2025-06-25 13:20:30 -07:00
Argyrios Kyrtzidis
d385e8c87a Merge pull request #81792 from sina-mahdavi/sina-mahdavi/fix-llvm-prefix-mapping-calls
fix calls to llvm prefix mapping functions to use space-separated opt…
2025-06-25 13:19:21 -07:00
Steven Wu
6f720c449e Merge pull request #82418 from cachemeifyoucan/eng/PR-caching-plugin-cas-path
[TEST-ONLY][Caching] Don't assume pluginCAS can be shared with builtinCAS
2025-06-25 12:27:42 -07:00
Xi Ge
5c530ea4e4 ABI checker: drop usage of AllowDeserializingImplementationOnly
AllowDeserializingImplementationOnly was historically added as a defensive
check against deserailzation issues introduced by @implementationOnly imports.
It's no longer specified by other tools, thus the ABI checker should drop
it as well.

rdar://153683760
2025-06-25 12:15:21 -07:00
Nate Chandler
a3c460988c [Test] Remove old test.
This test was never well-targeted and has been disabled for years.  We
have better coverage elsewhere.

rdar://98890125
2025-06-25 11:42:34 -07:00
Charles Zablit
344d24db14 [windows] make WindowsSDKs configurable through env variables 2025-06-25 18:25:25 +01:00
Doug Gregor
5391887b01 [Effects] Ensure that we properly substitute function types in ByClosure checks
We weren't substituting generic arguments into function types. In the
presence of parameter packs, this could mean that the parameter and
argument lists no longer match up, which would cause the effects
checker to prematurely bail out after treating this as "invalid" code.
The overall effect is that we would not properly check for throwing
behavior in this case, allowing invalid code (as in the example) and
miscompiling valid code by not treating the call as throwing.

Fixes rdar://153926820.
2025-06-25 10:01:34 -07:00
Artem Chikin
705b1a667f Merge pull request #82429 from artemcm/ScannerInvalidBinaryModuleRefactor
[Dependency Scanning] Refactor the scanner to simplify layering
2025-06-25 09:03:18 -07:00
Tony Allevato
180693b6ea Merge pull request #82453 from azarovalex/fix-overridden-typo
[Diagnostics] Fix typo in 'overridden' warning message and identifier
2025-06-25 11:01:41 -04:00
Hamish Knight
55ef1bcaf0 [SourceKit] Print backticks if needed in printDisplayName
Ensure we print raw identifier names with backticks for e.g the
document structure request.

rdar://152524780
2025-06-25 15:15:17 +01:00
Gábor Horváth
7f7a5b19eb Merge pull request #81024 from swiftlang/gaborh/fix-cpp-benchmarks
[cxx-interop] Reenable C++ benchmarks
2025-06-25 12:30:01 +02:00
Anthony Latsis
797548a085 AST: Fix out of sync diagnostic
`declared_protocol_conformance_here` depends on the raw values of
`ConformanceEntryKind`
2025-06-25 09:46:07 +01:00
Pavel Yaskevich
b41a21a114 Merge pull request #82465 from xedin/rdar-154202375
[Concurrency] Global actor isolated conformances are only allowed to …
2025-06-25 01:10:27 -07:00
Erik Eckstein
abbe0e8e95 TempLValueElimination: fix a stupid bug when combining copy_addr with a following destroy_addr
This peephole optimization also combined the instructions if the `destroy_addr` appears before the `copy_addr` in the same basic block.

https://github.com/swiftlang/swift/issues/82466
rdar://154236276
2025-06-25 08:09:55 +02:00
Andrew Trick
1a2d8e48fe Promote feature NonescapableAccessorOnTrivial to be non-experimental
This flag was not experimental for any good reason; it should always be
enabled. The flag only exists so we can introduce a new API:
UnsafeMutablePointer.mutableSpan. Supported compilers cannot handle the new API.

rdar://154247502 (Promote feature NonescapableAccessorOnTrivial to be
non-experimental)
2025-06-24 18:51:18 -07:00
Andrew Trick
17ae36e67c Merge pull request #81856 from atrick/projection-tests
Add tests for SILGen support of @_addressable annotations.
2025-06-24 18:13:01 -07:00
Guillaume Lessard
4a13c916d7 [stdlib] name your constants 2025-06-24 17:19:48 -07:00
Guillaume Lessard
e8f0d52fe2 [gardening] labels for conditional compilation markers 2025-06-24 17:10:37 -07:00
Andrew Trick
05a9afe18b Merge pull request #82450 from atrick/unsafe-mutablespan
Fix MutableSpan exclusive access to unsafe pointers
2025-06-24 16:14:52 -07:00
Adrian Prantl
e24e676520 Merge pull request #82336 from charles-zablit/charles-zablit/add-new-demangling-methods
add new methods to the NodePrinter to enable range tracking possibilities when demangling a name
2025-06-24 16:11:06 -07:00
Becca Royal-Gordon
66300b7e6e Test that @abi handles SendableMetatype
The `@abi` checker ignores uses of marker protocols, as they don’t have any impact on call compatibility. Add tests to ensure that this rule encompasses SE-0470’s `SendableMetatype`.

Fixes rdar://152602566.
2025-06-24 15:40:01 -07:00
Pavel Yaskevich
4804f2131b [CSSimplify] Narrow down tuple wrapping for pack expansion matching
Follow-up for https://github.com/swiftlang/swift/pull/82326.

The optional injection is only viable is the wrapped type is
not yet resolved, otherwise it's safe to wrap the optional.
2025-06-24 15:30:25 -07:00
Doug Gregor
ab4e87fe5a Merge pull request #82443 from DougGregor/preconcurrency-unsafe-silence
Allow '@unsafe' on import declarations to silence '@preconcurrency' warning
2025-06-24 13:49:55 -07:00
Sina Mahdavi
7090b7e145 fix calls to llvm prefix mapping functions to use space-separated option format 2025-06-24 13:32:55 -07:00
Pavel Yaskevich
2e1fe444a6 [Concurrency] Global actor isolated conformances are only allowed to override nonisolated.
Follow-up for https://github.com/swiftlang/swift/pull/79893.

More than one global actor isolated conformance at any level
creates a clash and conforming type should be inferred as `nonisolated`.

Resolves: rdar://154202375
2025-06-24 12:46:41 -07:00
eeckstein
830a842b7b Merge pull request #82455 from eeckstein/adress-of-borrow-feature
Guard InlineArray addressors with feature flag
2025-06-24 20:58:18 +02:00
Max Desiatov
92dd843a18 Fix building Wasm stdlib with macOS presets (#80850)
Added optional `ignore_extra_cmake_options` to `cmake_product.py`, existing behavior is preserved with the default argument value set to `False`.

Passed `ignore_extra_cmake_options=True` in `wasisysroot.py`. This allows libc++ for WASI to be built correctly with `-fno-exceptions` in presence of `extra-cmake-options` in macOS presets (which are absent in Linux presets).
2025-06-24 11:15:25 -07:00
Egor Zhdan
1a84348447 Merge pull request #82454 from swiftlang/egorzhdan/runtime-avail
[cxx-interop] Fix test failure on older macOS
2025-06-24 18:18:53 +01:00
Gabor Horvath
3dda301496 [cxx-interop] Reenable C++ benchmarks
The underlying issue was fixed in #82309

rdar://149402670
2025-06-24 17:57:42 +01:00
Allan Shortlidge
24aaff9fba Merge pull request #82434 from tshortli/reorganize-availability
SILGen: Reorganize some availability related code
2025-06-24 09:21:38 -07:00
Evan Wilde
b9f73d5b4e Merge pull request #82433 from etcwilde/ewilde/sourcekitd-rpaths
FreeBSD: Set sourcekitInProc rpaths
2025-06-24 09:16:19 -07:00