Commit Graph

46165 Commits

Author SHA1 Message Date
Andrew Trick
97612ada46 LifetimeDependence type checker diagnostic IDs and messages
Rework the type checker's diagnostics to support completely checking lifetime
dependence requirements. Don't let anything through without the feature being
enabled and complete annotation or inference.
2025-03-19 11:59:04 -07:00
Andrew Trick
6adc65b1d5 Comment: getLifetimeDependencies parameter lowering. 2025-03-19 11:59:04 -07:00
Anthony Latsis
3d3b1ca50a [NFC] AST: Turn getParameterList into a method on ValueDecl 2025-03-19 18:49:15 +00:00
Amritpan Kaur
98cd675eb9 Guard feature behind experimental flag. 2025-03-19 10:54:09 -07:00
Amritpan Kaur
60e03a85d9 [SILGen] Lower applied keypath methods. 2025-03-19 10:54:09 -07:00
Amritpan Kaur
43df15e514 [SILGen] Add KeyPathComponentKind. 2025-03-19 10:54:09 -07:00
Amritpan Kaur
e7e354d989 [NFC] Generalize subscript code for methods. 2025-03-19 10:54:09 -07:00
Amritpan Kaur
555a486cda [Mangler] Add new mangling schemes. 2025-03-19 10:54:06 -07:00
Pavel Yaskevich
ac91d39a95 [DiagnosticBridge] NFC: Refactor addQueuedDiagnostic to use BridgedCharSourceRange for diagnostic highlights 2025-03-19 10:18:09 -07:00
Pavel Yaskevich
49f254f9f1 [DiagnosticBridge] NFC: Refactor addQueuedDiagnostic to use BridgedSourceLoc to diagnostic location 2025-03-19 09:54:41 -07:00
Pavel Yaskevich
2ee821164d [DiagnosticBridge] NFC: Refactor addQueuedDiagnostic to use BridgedStringRef instead of plain pointers 2025-03-19 09:54:36 -07:00
Pavel Yaskevich
552106d536 Merge pull request #80081 from xedin/rdar-143161190
[CSSimplify] Open key path type before assignment to its record requirements
2025-03-19 09:50:11 -07:00
Artem Chikin
04015fef77 [Dependency Scanning] Adopt new clang scanner API to place stable modules into an SDK-specific module cache 2025-03-19 10:43:42 -06:00
Amritpan Kaur
86d456e4eb [Sema] Block inout method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
a96b780a28 [Sema] Diagnose method arg captures that are not Hashable/Equatable. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
970159c09d [CSDiagnostics] Block async, throws and mutating methods. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
7ff563eb0c [CSDiagnostics] Remove checks preventing method/initializer keypaths. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
724e3f9910 [Constraint System] Evaluable hashability during constraint generation. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
978a5215d5 [Expr/AST] Add apply component to handle resolved method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
0c614e09d1 [Expr/AST] Add unresolvedApply component to handle method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
2583da94b2 [NFC] Generalize subscript index handling. 2025-03-19 08:53:18 -07:00
Amritpan Kaur
811d54901b [NFC] Rename unresolvedProperty to unresolvedMember
to generalize for both properties and method members.
2025-03-19 08:53:18 -07:00
Amritpan Kaur
8f71f5c780 [NFC] Rename property to member to generalize
for both properties and method members.
2025-03-19 08:53:18 -07:00
Mike Ash
953a7a5b74 [Runtime] Include size/alignment in allocation failure fatal error message.
It's hard to tell why a crash occurred with just "Could not allocate memory." Modify the message to include the size/alignment, which will help distinguish between an actual lack of memory and a request for an excessively large allocation.

While we're in there, add \n to a bunch of other fatal error helper functions that didn't have it.
2025-03-19 11:18:43 -04:00
Artem Chikin
88dec5199e [Dependency Scanning] Add support for placing explicitly-built SDK modules into a separate module cache
With '-sdk-module-cache-path', Swift textual interfaces found in the SDK will be built into a separate SDK-specific module cache.
Clang modules are not yet affected by this change, pending addition of the required API.
2025-03-19 09:17:04 -06:00
eeckstein
aeeeb81b60 Merge pull request #80113 from eeckstein/refactor-optimizer-bridging
Optimizer: move optimizer bridging code from `PassManager.cpp` into its own file
2025-03-19 15:30:34 +01:00
Slava Pestov
6a3ead3a44 Merge pull request #80107 from slavapestov/for-abstract-conformance
Fix a few more callers of ProtocolConformanceRef::forAbstract() to pass in a subject type
2025-03-19 07:15:27 -04:00
Erik Eckstein
cf8c8561ca Optimizer: move optimizer bridging code from PassManager.cpp into its own file.
The bridging code was in PassManager.cpp only for historical reasons.
It's now in OptimizerBridging.cpp.

NFC
2025-03-19 09:28:53 +01:00
eeckstein
c28279f3f1 Merge pull request #80095 from eeckstein/cleanup-passes-def
PassManager: cleanup Passes.def
2025-03-19 06:56:26 +01:00
Holly Borla
8ec70e2559 [Macros] Gate closure body macros behind an experimental feature flag. 2025-03-18 20:50:47 -07:00
Holly Borla
31d4f661fc [Macros] Support function body macros on closures. 2025-03-18 20:50:47 -07:00
Doug Gregor
a02633ad47 Merge pull request #80103 from DougGregor/strict-safety-more-minor-cleanups 2025-03-18 20:29:25 -07:00
Slava Pestov
8bcd09aaa4 SIL: Preliminary refactoring of SILWitnessTable::AssociatedConformanceWitness
The Protocol field isn't really necessary, because the conformance
stores the protocol. But we do need the substituted subject type
of the requirement, just temporarily, until an abstract conformance
stores its own subject type too.
2025-03-18 19:38:42 -04:00
Slava Pestov
efbeaea969 AST: Always-on ASSERTs for ProtocolConformanceRef
If any of the get*() methods are called on the wrong kind of
ProtocolConformanceRef, we immediately cast a pointer to an
incorrect type, which will most likely cause a crash.
2025-03-18 19:38:20 -04:00
Pavel Yaskevich
cfad698202 [CSDiagnostics] Tailor diagnostic for Escapable conformance mismatch in key path context 2025-03-18 14:38:40 -07:00
Doug Gregor
9570e1e3a7 [SE-0458] Add fix-it for removing unnecessary "unsafe" keywords 2025-03-18 13:57:16 -07:00
Doug Gregor
4742d2c5db [SE-0458] withoutActuallyEscaping is unsafe for @convention(block)
The implementation of `withoutActuallyEscaping` for `@convention(block)`
functions cannot verify at runtime that the function did not actually
escape. Diagnose this as unsafe code under strict memory safety checking.

Fixes rdar://139994149.
2025-03-18 13:26:47 -07:00
Mike Ash
38c4fce1a8 [Concurrency] Fix a race when using cancelAll on a task group concurrently with child tasks being removed.
_swift_taskGroup_cancelAllChildren relies on there being no concurrent modification when called from the owning task, but this is not guaranteed.

Rearrange things to always take the owning task's status record lock when walking the group's children. Split _swift_taskGroup_cancelAllChildren into two functions, one which assumes/requires the lock is already held, and one which acquires the lock. We don't have the owning task in this case, but we can either get it from the current task, or by looking at the parent of the child task we're working on.

rdar://147172991
2025-03-18 14:52:07 -04:00
Steven Wu
fc16f3faf4 Merge pull request #80068 from cachemeifyoucan/eng/PR-enable-deterministic-check 2025-03-18 11:09:16 -07:00
Meghana Gupta
30a364d3f0 Merge pull request #80031 from meg-gupta/closurelifetimefixup
Fix ClosureLifetimeFixup to insert destroys at leaking blocks
2025-03-18 10:40:31 -07:00
Erik Eckstein
62ea5b1c81 PassManager: cleanup Passes.def
* move the "SILCombine passes" into a separate file `Simplifications.def` which lives in the SILCombiner directory
* group passes by kind
* rename PASS -> LEGACY_PASS and add a comment to make clear that new passes should be implemented in Swift

NFC
2025-03-18 18:34:52 +01:00
Allan Shortlidge
7e7b234291 Merge pull request #80084 from tshortli/custom-domain-runtime-availability
AST: Skip SILGen for decls that are unavailable in custom domains
2025-03-18 06:26:24 -07:00
Anthony Latsis
ad3a5adc6d Merge pull request #80008 from AnthonyLatsis/danaus-plexippus-4 2025-03-18 13:24:17 +00:00
Allan Shortlidge
5e0eb09fc0 AST: Skip codegen for decls that are unavailable in custom domains.
Regardless of the value specified for `-unavailable-decl-optimization`, decls
that are unavailable in custom availability domains should be treated as always
unreachable at runtime.

Part of rdar://138441307.
2025-03-17 22:46:07 -07:00
Allan Shortlidge
7ae3a86d9b AST: Introduce "root" availability domains.
A root availability domain is a direct descendant of the universal availability
domain.
2025-03-17 22:09:28 -07:00
Joe Groff
24a91bba5d Merge pull request #80038 from jckarter/addressable-for-deps-lowering
SIL: Lower fields that are conditionally addressable because of a dependency.
2025-03-17 21:28:33 -07:00
Michael Gottesman
8c86984390 Merge pull request #80071 from gottesmm/pr-3d96950196ba1261544c5bf8ace8a5a4c439f54d
[gardening] Remove this-> from LangOpts that was added by mistake.
2025-03-17 20:34:37 -07:00
Michael Gottesman
0b2c160740 Merge pull request #80070 from gottesmm/swift-settings-only-once
[swift-settings] Only allow for a setting to be passed exactly once to #SwiftSettings.
2025-03-17 19:12:00 -07:00
Anthony Latsis
c49947579a Sema: Implement adoption mode for AsyncCallerExecution 2025-03-18 01:58:31 +00:00
Slava Pestov
145a7c5fe2 Merge pull request #80057 from slavapestov/fix-rdar146780049
Sema: Fix non-determinism with ConstraintSystem::ConstraintRestrictions
2025-03-17 21:28:01 -04:00