Commit Graph

185384 Commits

Author SHA1 Message Date
Slava Pestov
c5d8ae5b00 Sema: Remove unused variable 2025-07-06 11:22:55 -04:00
Slava Pestov
f8cf708753 RequirementMachine: Increase default type differences limit to 13000
Fixes rdar://154684522.
2025-07-06 11:22:47 -04:00
Doug Gregor
de8bf25082 Merge pull request #82815 from DougGregor/isolated-conformance-without-concurrency-runtime 2025-07-05 23:07:15 -07:00
Slava Pestov
ed329944fa Merge pull request #82757 from slavapestov/fix-issue-60552
Sema: Fix leading dot with protocol composition or parameterized protocol contextual type
2025-07-05 14:57:59 -04:00
Doug Gregor
15123f5771 [Runtime] Don't fail conformances when the global actor hook is missing
When the concurrency library's "is current global actor" hook is not
available, assume that we are already executing on the right global
actor. This mimics the behavior of earlier standard libraries when
faced with an isolated conformance, as well as dealing with odd
configurations where the code might not load the concurrency library
yet

At the moment, WebAssembly ends up in this configuration because we
don't run the initialization for the concurrency library. That makes
this also a workaround for issue #82682 / rdar://154762027.
2025-07-05 08:50:26 -07:00
Doug Gregor
62770ff2d7 Extend region analysis to account for isolated conformances
When a conformance becomes part of a value, and that conformance could
potentially be isolated, the value cannot leave that particular
isolation domain. For example, if we perform a runtime lookup for a
conformance to P as part of a dynamic cast `as? any P`, the
conformance to P used in the cast could be isolated. Therefore, it is
not safe to transfer the resulting value to another concurrency domain.

Model this in region analysis by considering whether instructions that
add conformances could end up introducing isolated conformances. In
such cases, merge the regions with either the isolation of the
conformance itself (if known) or with the region of the task (making
them task-isolated). This prevents such values from being sent.

Note that `@concurrent` functions, which never dynamically execute on
an actor, cannot pick up isolated conformances.

Fixes issue #82550 / rdar://154437489
2025-07-05 07:13:02 -07:00
Dave Lee
3ac427f94e [utils] Update Demangle::Node data formatter (#82739)
Updates the lldb data formatter for `Demangle::Node` to reflect the
current `PayloadKind` enum values (which were changed in
https://github.com/swiftlang/swift/pull/72884).
2025-07-04 21:36:37 -07:00
Meghana Gupta
61fc2e052a Merge pull request #82787 from meg-gupta/lifetimediag
Fix a lifetime dependence diagnostic
2025-07-04 21:11:45 -07:00
Max Desiatov
de5aa3f2ba lit.cfg: fix test subset error message (#82806)
Currently when test subset is not specified, `lit.cfg` provides an error message that refers to test modes instead of tests subsets. Making error messages distinct makes it easier to backtrack in lit.cfg source code when diagnosing the root cause.
2025-07-04 16:06:24 -07:00
Saleem Abdulrasool
d9b0b9e0e1 Merge pull request #82734 from compnerd/tree-structuring
utils: adjust tree layout modification logic for static SDKs
2025-07-04 15:46:56 -07:00
Max Desiatov
461f7d026b Fix typo in reset func in productpipeline_list_builder.py (#82777)
`pipelinst_list` -> `pipeline_list`

There are no other uses of `pipelinst_list`, so it's clearly a typo when trying to refer to `pipeline_list`
2025-07-04 23:02:16 +01:00
Andrew Trick
6fe77328cc Merge pull request #82796 from atrick/local-deadend
Improve LocalVariableUtils.gatherKnownLifetimeUses; dead ends
2025-07-04 12:50:24 -07:00
nate-chandler
6c87a0c2e7 Merge pull request #82736 from nate-chandler/rdar154499140
[SemanticARCOpts] Always heed subpass flags.
2025-07-04 11:15:18 -07:00
Pavel Yaskevich
0444d297b6 [AST/Sema] SE-0487: Remove @preEnumExtensibility attribute 2025-07-04 11:06:44 -07:00
Pavel Yaskevich
43eec8fede [AST/Sema] SE-0487: Expand @nonexhaustive attribute to support warn argument
The spelling `@nonexhaustive(warn)` replaces `@preEnumExtensibility`
attriubte.
2025-07-04 10:20:25 -07:00
Pavel Yaskevich
5195e899ee Merge pull request #82792 from xedin/rdar-154719565-workaround-with-disfavored
[SwiftCompilerSources] Disfavor overload of `==` that takes `StringRef`
2025-07-04 09:32:10 -07:00
Egor Zhdan
c06951e3af Merge pull request #74146 from swiftlang/egorzhdan/std-optional-init-value
[cxx-interop] Instantiate `std::optional` value constructors
2025-07-04 16:33:28 +01:00
Max Desiatov
0c4e56174b Merge pull request #82399 from swiftlang/maxd/embedded-wasm-tests
These tests still require a manual `lit.py` invocation for Wasm, which will be added as a separate CMake target in a future PR.
2025-07-04 15:36:15 +01:00
Hamish Knight
3a8bf75951 Merge pull request #82761 from hamishknight/req-assert
[test] Require asserts for IDE crashers
2025-07-04 14:10:10 +01:00
Hamish Knight
20bbd8d8c2 Merge pull request #82770 from hamishknight/simple-fix
[CS] Ensure type variables are eliminated by `Solution::simplifyType`
2025-07-04 14:08:27 +01:00
Yuta Saito
05204bdf63 Merge pull request #82285 from kateinoigakukun/yt/build-foundation 2025-07-04 22:02:14 +09:00
Hamish Knight
e7bf62dd81 [Completion] Map failable initializer result type into context
Make sure we don't pass an interface type to `setTypeContext`.

rdar://155038769
2025-07-04 13:55:40 +01:00
Max Desiatov
572c52955b NFC: Fix doc comment typo in productpipeline_list_builder.py (#82771)
`Product a final schedule` -> `Produce a final schedule`
2025-07-04 05:49:38 -07:00
eeckstein
f5fae2dcd9 Merge pull request #82766 from eeckstein/fix-metatype-in-mpo
MandatoryPerformanceOptimizations: don't specialize vtables for thin class metatype instructions
2025-07-04 11:52:04 +02:00
nate-chandler
4c1dbd74c7 Merge pull request #82784 from nate-chandler/rdar153693915
[Mem2Reg] Don't promote proj(unchecked_addr_cast).
2025-07-04 02:02:16 -07:00
Alastair Houghton
57d056e1a3 Merge pull request #82457 from al45tair/external-executor-test-support
[Concurrency] Add functions to allow testing of external executors.
2025-07-04 09:52:57 +01:00
Ben Barham
d9b220c954 Merge pull request #82708 from Bigcheese/dev/importer-ub
[ClangImporter] Fix dangling reference.
2025-07-04 00:13:43 -07:00
Nate Cook
85208293c9 Allow inout parameters in expression macros (#82370)
Sema seems to be flagging inout expressions (e.g. &foo) in expression
macros as invalid, setting up a catch 22 where Sema emits an error when
a parameter has the '&' sigil and type checking fails when it doesn't.

This resolves the issue by allowing inout expressions inside macro
expansion expressions.

Resolves https://github.com/swiftlang/swift/issues/82369.
2025-07-03 23:52:16 -07:00
Ben Barham
00fcb51cea Merge pull request #82794 from bnbarham/foundation-j-1
[Build] Temporarily add -j 1 to swift-corelibs-foundation Windows build
2025-07-03 23:50:09 -07:00
Pavel Yaskevich
ed5fd4eeaf Merge pull request #82673 from xedin/rdar-154695053
[Concurrency] SE-0463: `Sendable` inference on sync and async variant…
2025-07-03 23:17:19 -07:00
eeckstein
a0c6ecacb9 Merge pull request #82762 from eeckstein/fix-escape-utils
EscapeUtils: consider that a pointer argument can escape a function call
2025-07-04 07:53:15 +02:00
Doug Gregor
deec3e1cd5 [SE-0470] Warn about isolated conformance to SendableMetatype-inheriting protocol
An isolated conformance to a SendableMetatype-inheriting protocol
cannot actually be used in generic code, because the SendableMetatype
requirement itself prevents it. Warn about this case so folks aren't
surprised at runtime.

This is a part of issue #82550 / rdar://154437489.
2025-07-03 22:27:23 -07:00
Doug Gregor
507c4056aa [SE-0470] Check uses of isolated conformances in collection literals
Fixes rdar://151646584.
2025-07-03 22:27:23 -07:00
Andrew Trick
239255b8bc Improve LocalVariableUtils.gatherKnownLifetimeUses; dead ends
Add a fake use for dead-end blocks. This allows gatherKnownLifetimeUses to be
used for local liveness by considering an "unreachable" instruction to generate
liveness. This is important when liveness is used as a boundary within which
access scopes may be extended. Otherwise, we are unable to extend access scopes
into dead-end blocks.

Fixes rdar://154406790 (Lifetime-dependent variable 'X' escapes its
scope but only if actor/class is final)
2025-07-03 21:30:37 -07:00
Ben Barham
c78fa45555 [Build] Temporarily add -j 1 to swift-corelibs-foundation Windows build
We haven't been able to reproduce with `-j 1` yet. While it's slower, at
least we might be able to unblock CI while we continue to investigate.
2025-07-03 18:45:16 -07:00
Konrad 'ktoso' Malawski
b0d2ca9be6 [Concurrency] Fix nonisolated(nonsending) interaction with #isolation 2025-07-04 10:20:08 +09:00
Pavel Yaskevich
fe1ae75711 [AST/Sema] SE-0487: Rename @extensible into @nonexhaustive
This is an accepted spelling for the attribute. This commit
also renames the feature flag from `ExtensibleAttribute` to
`NonexhaustiveAttribute` to match the spelling of the attribute.
2025-07-03 17:50:05 -07:00
Pavel Yaskevich
e3a5477bf9 [SwiftCompilerSources] Disfavor overload of == that takes StringRef
This overload is disfavored to make sure that it's only used for cases
that don't involve literals, for that `==(StringRef, StaticString) -> Bool`
is preferred. Otherwise these overloads are going to be ambiguous
because both `StringRef`, `StaticString` conform to `ExpressibleByStringLiteral`.

Consider the following example:

```swift
func test(lhs: StringRef) {
  lhs == "<<test>>"
}
```

The type-checker used to pick `==(StringRef, StringRef)` overload in this
case because it has homogenous parameter types but this is no longer the
case because this behavior was too aggressive and led to sub-optimal choices
by completely skipping other viable overloads.

Since `StaticString` already represents literals it's better to use
a standard library type and reserve the `(StringRef, StringRef)`
overload to when the literals are not involved.

Resolves: rdar://154719565
2025-07-03 16:57:28 -07:00
Mishal Shah
65d9f5f71c Merge pull request #82729 from etcwilde/ewilde/build-script-divide-by-zero
Build-Script: Don't divide by zero
2025-07-03 15:46:49 -07:00
Alexis Laferrière
f101bfd969 Merge pull request #82697 from xymus/cdecl-misc
AST: Misc improvements to `@decl` enums: implicit names, code gen fix and more tests
2025-07-03 15:44:34 -07:00
Meghana Gupta
b4a5a0b0ef Merge pull request #82786 from xedin/rdar-154969621-disable-test
[Tests] Temporarily disable `test/Concurrency/transfernonsendable_clo…
2025-07-03 15:38:44 -07:00
Meghana Gupta
6d0a6d2760 Fix a lifetime dependence diagnostic
`LifetimeDescriptor::getName()` can crash if the descriptor had a `self`.
Replace with `LifetimeDescriptor::getString()`
2025-07-03 15:20:23 -07:00
Pavel Yaskevich
e05ca06425 [Tests] Temporarily disable test/Concurrency/transfernonsendable_closureliterals_isolationinference.swift
We are working on a fix but need to disable the test temporarily to unblock CI.
2025-07-03 15:14:27 -07:00
Max Desiatov
3aeffef54e Fix import path in productpipeline_list_builder.py 2025-07-03 22:57:38 +01:00
Nate Chandler
41877ae7b7 [Mem2Reg] Don't promote proj(unchecked_addr_cast).
In OSSA, the result of an `unchecked_bitwise_cast` must immediately be
copied or `unchecked_bitwise_cast`'d again.  In particular, it is not
permitted to borrow it.  For example, the result can't be borrowed for
the purpose of performinig additional projections (`struct_extract`,
`tuple_extract`) on the borrowed value.  Consequently, we cannot promote
an address if such a promotion would result in such a pattern.  That
means we can't promote an address `%addr` which is used like
`struct_element_addr(unchecked_addr_cast(%addr))` or
`tuple_element_addr(unchecked_addr_cast(%addr))`.  We can still promote
`unchecked_addr_cast(unchecked_addr_cast(%addr))`.

In ownership-lowered SIL, this doesn't apply and we can still promote
address with such projections.

rdar://153693915
2025-07-03 14:52:23 -07:00
Saleem Abdulrasool
a2f5d2a746 Merge pull request #82699 from compnerd/feature
ClangImporter: remove Darwin alias workaround, introduce feature
2025-07-03 13:45:45 -07:00
Max Desiatov
be4ff14bca Add type annotations to ProductPipeline in build-script
This prevents possible runtime type errors and helped uncovering https://github.com/swiftlang/swift/pull/82777. It also server as an improvement o documentation, as provides inferred type annotations for users of this class and callers of its methods.
2025-07-03 19:19:08 +01:00
Evan Wilde
576a3784b6 Merge pull request #82698 from etcwilde/ewilde/skip-unused-section-headers
RemoteInspection: Skip unused ELF section headers
2025-07-03 10:33:19 -07:00
Konrad `ktoso` Malawski
ec8caf3cdd Remove the experimental @Task macro (#82437) 2025-07-03 10:15:21 -07:00
Pavel Yaskevich
79af04ccc4 Merge pull request #82731 from xedin/rdar-154808850
[Concurrency] SE-0461: Extend `nonisolated(nonsending)` inference to function types
2025-07-03 09:17:10 -07:00