Commit Graph

46689 Commits

Author SHA1 Message Date
Alexis Laferrière
7642d410af Merge pull request #83814 from xymus/cdecl-enum-layout
IRGen: Use C compatible representation for `@cdecl` enums
2025-08-20 10:39:09 -07:00
Steven Wu
14eb1e4aad Merge pull request #83816 from cachemeifyoucan/eng/PR-158692095
[Caching] Fix typecheck swiftinterface with prefix map
2025-08-20 10:00:53 -07:00
Slava Pestov
36c49ea9d6 AST: Allow substitution limits >= 32767 2025-08-20 12:26:38 -04:00
Pavel Yaskevich
187903f3c1 Merge pull request #83823 from xedin/SE-0487-has-been-accepted
[AST] SE-0487: Promote `NonexhaustiveAttribute` to a language feature
2025-08-20 09:11:20 -07:00
Hamish Knight
303c1ee951 Merge pull request #83803 from hamishknight/err-fallback 2025-08-20 10:13:23 +01:00
Pavel Yaskevich
a7ecd309d4 [AST] SE-0487: Promote NonexhaustiveAttribute to a language feature
The proposal [has been accepted](https://forums.swift.org/t/accepted-se-0487-nonexhaustive-enums/81508)
which makes the feature experimental no longer.
2025-08-20 00:39:51 -07:00
Meghana Gupta
50be389644 Merge pull request #83817 from meg-gupta/promotefeature
Promote LifetimeDependenceMutableAccessors and InoutLifetimeDependence to language features
2025-08-19 17:35:45 -07:00
Alexis Laferrière
b624ee96fe AST: Introduce EnumDecl::isCDeclEnum and isCCompatibleEnum 2025-08-19 13:40:09 -07:00
Meghana Gupta
9f435ad5bd Promote LifetimeDependenceMutableAccessors and InoutLifetimeDependence to language features
These were added to guard specific source code in swift interface files for older compilers.
They do not guard any experimental language feature specifically.
Turn them on by default to prevent unnecessary flags developers need to add in their configs.
2025-08-19 11:50:49 -07:00
Steven Wu
b18e865b0a [Caching] Fix typecheck swiftinterface with prefix map
SwiftVerifyEmittedModuleInterface job is configured to be built within
the SubInvocation and it needs to inherit the caching replay prefix map
in order to load macro plugin library correctly.

rdar://158692095
2025-08-19 10:28:20 -07:00
Hamish Knight
5c3f6703a0 Remove diag::type_of_expression_is_ambiguous
This is a diagnostic that is only really emitted as a fallback when
the constraint system isn't able to better diagnose the expression.
It's not particulary helpful for the user, and can be often be
misleading since the underlying issue might not actually be an
ambiguity, and the user may well already have a type annotation. Let's
instead just emit the fallback diagnostic that we emit in all other
cases, asking the user to file a bug.
2025-08-19 17:14:23 +01:00
Hamish Knight
a554080a82 Make failed_to_produce_diagnostic non-fatal 2025-08-19 17:14:05 +01:00
Kuba (Brecka) Mracek
4ca136a9b9 Merge pull request #83791 from kubamracek/const-objcbool
[ClangImporter] Skip importing values for ObjCBool declarations
2025-08-19 07:37:19 -07:00
Egor Zhdan
3d3331f1c6 Merge pull request #83787 from egorzhdan/egorzhdan/weak-reference
[cxx-interop] Prohibit weak references to foreign reference types
2025-08-19 12:15:38 +01:00
Kuba Mracek
7b0eff8616 [ClangImporter] Skip importing values for ObjCBool declarations 2025-08-18 10:16:51 -07:00
Egor Zhdan
9abadf5483 [cxx-interop] Prohibit weak references to foreign reference types
This fixes a runtime crash when a `weak` reference to a C++ foreign reference type is used.

Instead of a runtime crash, Swift would now emit a compiler error saying that `weak` keyword is incompatible with foreign reference types.

rdar://124040825 / resolves https://github.com/swiftlang/swift/issues/83080
2025-08-18 18:08:43 +01:00
Nate Chandler
5da38cb04b [NFC] OSSACanonicalizeGuaranteed: Renamed. 2025-08-18 09:45:27 -07:00
Nate Chandler
8f1d6616af [NFC] OSSACanonicalizeOwned: Renamed. 2025-08-18 09:45:21 -07:00
Nate Chandler
aa85694237 [NFC] OSSACompleteLifetime: Renamed. 2025-08-18 09:45:19 -07:00
Artem Chikin
89b43dccf3 Merge pull request #83600 from artemcm/NoRedundantClangDepBridging
[Dependency Scanning] Bridge Clang dependency scanner results on-demand
2025-08-18 09:36:27 -07:00
Doug Gregor
4ff65cc244 Merge pull request #83784 from DougGregor/never-emit-into-client
Add @_neverEmitIntoClient to prohibit SIL serialization for a function
2025-08-18 04:19:59 -07:00
Egor Zhdan
d8edd86cfb Merge pull request #83753 from egorzhdan/egorzhdan/retain-release-unsigned
[cxx-interop] Allow retain/release operations to return an unsigned integer
2025-08-18 11:52:33 +01:00
Doug Gregor
2f60d729f0 Add @_neverEmitIntoClient to prohibit SIL serialization for a function
Part of the Embedded Swift linkage model, this attribute ensures that
the function it applies to has a strong definition in its owning
module, and that its SIL is never serialized. That way, other modules
will not have access to its definition.

Implements rdar://158364184.
2025-08-17 23:21:57 -07:00
Doug Gregor
7a196ac3ba Merge pull request #83739 from DougGregor/embedded-weak-definitions-of-imports
[Embedded] Emit weak definitions for imported symbols
2025-08-17 20:25:02 -07:00
Doug Gregor
9a20ebac5b [Embedded] Emit weak definitions for imported symbols
When Embedded Swift emits a symbol that was imported from another
module, ensure that the symbol is emitted as a weak definition. This
way, importing the same module (and using its symbol) into several
different modules doesn't cause duplicate-symbol errors at link time.
Rather, the linker will merge the different symbol definitions. This
makes Embedded Swift libraries work without resorting to
`-mergeable-symbols` or `-emit-empty-object-file`.
2025-08-17 15:26:08 -07:00
Doug Gregor
c91a4822d3 Serialize the "markedAsUsed" bit for SILGlobalVariable 2025-08-17 15:25:50 -07:00
Andrew Trick
1cb6ab5359 Merge pull request #83763 from atrick/fix-dce-struct-deinit
SIL: fix miscompiles of non-Copyable struct/enum with deinits
2025-08-17 12:33:45 -07:00
Hamish Knight
45065f3069 [Diags] Allow multiple in-flight diagnostics
Lift the limitation of a single active diagnostic, which was a pretty
easy-to-hit footgun. We now maintain an array of active in-flight
diagnostics, which gets flushed once all them have ended.
2025-08-17 11:48:21 +01:00
Hamish Knight
114ea293c4 Merge pull request #82058 from a7medev/feat/access-control-set-fix-it
[Diagnostics] Add fix-its for missing `set` and `)` after access modifier
2025-08-16 18:42:28 +01:00
Slava Pestov
a983323508 Merge pull request #83768 from slavapestov/replace-covariant-result-type
Sema: Remove a bunch of usages of replaceCovariantResultType()
2025-08-16 08:56:12 -04:00
Gábor Horváth
16fbfec493 Merge pull request #83754 from Xazax-hun/reenable-addressable-params 2025-08-16 09:17:46 +01:00
Tim Kientzle
3451abc2b9 Merge pull request #83770 from DmT021/revert/conformance-cache-by-descriptor
Revert "Protocol conformance cache for generic types"
2025-08-16 00:36:47 -07:00
Allan Shortlidge
43df44dcbd Merge pull request #83769 from tshortli/availability-domain-for-decl-request
AST: Request-ify getting the AvailabilityDomain from a ValueDecl
2025-08-15 21:39:30 -07:00
Hamish Knight
89787e24b6 Merge pull request #83766 from hamishknight/fifty-thousand-ants
[CS] Use apply component locator for `verifyThatArgumentIsHashable`
2025-08-16 05:20:51 +01:00
Artem Chikin
290cf834b4 Merge pull request #83767 from artemcm/FixIncScanImportSerialization
[Dependency Scanning] Fix optional import statement serialization logic
2025-08-15 21:18:39 -07:00
Dmitrii Galimzianov
4509b22415 Revert "Protocol conformance cache for generic types"
This reverts commit 7989dbe24e merged in https://github.com/swiftlang/swift/pull/82818
2025-08-16 01:39:16 +02:00
Allan Shortlidge
678b0934d6 AST: Request-ify getting the AvailabilityDomain from a ValueDecl.
Cache the result of turning a `ValueDecl` into an `AvailabilityDomain`. Use
split caching to make the common case of the decl not representing an
availability domain efficient.

NFC.
2025-08-15 16:15:36 -07:00
nate-chandler
12abf7ee37 Merge pull request #83741 from nate-chandler/rdar158353230
[OSSA] Fix borrowCopyOverGuaranteedUsers at dead-ends.
2025-08-15 16:14:58 -07:00
Artem Chikin
b14cbbb039 [Dependency Scanning] Add serialization of optional imports to the JSON output
And to the corresponding graph data structure the output gets generated from
2025-08-15 16:11:13 -07:00
Artem Chikin
9f0083c7c0 [Dependency Scanning] Refactor Clang dependency bridging into a 'ModuleDependencyScanner' utility
This moves the functionality of 'bridgeClangModuleDependency' into a utility in the main scanner class because it relies on various objects whose lifetime is already tied to the scanner itself.
2025-08-15 15:40:41 -07:00
Andrew Trick
9d40198c0f SIL: fix miscompiles of non-Copyable struct/enum with deinits
The SIL optimizer has fundamental bugs that result in dropping non-Copyable
struct & enum the deinitializers.

Fix this by

1. correctly representing the ownership of struct & enum values that are
   initialized from trivial values.

2. checking move-only types before deleting forwarding instructions.

These bugs block other bug fixes. They are exposed by other unrelated SIL
optimizations to SIL. I'm sure its possible to expose the bugs with source-level
tests, but the current order of inlining and deinit devirtualization has been
hiding the bugs and complicates reproduction.
2025-08-15 15:03:50 -07:00
Artem Chikin
5015ba683a [Dependency Scanning] Bridge Clang dependency scanner results on-demand
Instead of always bridging all of the discovered modules of all of the queries, only do so for modules which are not already cached
2025-08-15 14:55:42 -07:00
Hamish Knight
4423399fce [CS] Use apply component locator for verifyThatArgumentIsHashable
For a method key path use the locator for the apply itself rather
than the member, ensuring we handle invalid cases where the apply is
the first component, and providing more accurate location info.
2025-08-15 21:30:22 +01:00
Slava Pestov
8007295715 AST: Introduce TypeBase::replaceDynamicSelfType() 2025-08-15 14:40:39 -04:00
Slava Pestov
a399c46db7 Sema: Pull preconcurrency adjustment out of getUnopenedTypeOfReference() 2025-08-15 14:39:14 -04:00
Egor Zhdan
3887ed0637 [cxx-interop] Allow retain/release operations to return an unsigned integer
Release/retain functions for C++ foreign reference types might return a reference count as an integer value.

Swift previously emitted an error for such functions, saying that the retain/release functions need to return void or a reference to the value.

rdar://157853183
2025-08-15 17:30:53 +01:00
Gabor Horvath
2a9f6f89e3 Revert "Merge pull request #83483 from Xazax-hun/turn-off-addressable"
Afteri #83712 landed, let's make another try enabling addressable
parameters by default.

This reverts commit 61d60eb6ad, reversing
changes made to 670f69eadc.
2025-08-15 15:28:20 +01:00
Ahmed Mahmoud
df0eda93f4 [IDE] Update comments for access control missing set fix-its 2025-08-15 15:23:29 +03:00
Slava Pestov
4146a7f935 Merge pull request #83736 from slavapestov/fix-rdar157329046
Sema: New opaque return type circularity check that doesn't trigger lazy type checking of bodies
2025-08-14 23:46:01 -04:00
Allan Shortlidge
6ad2066ffc Merge pull request #83731 from tshortli/availability-domain-value-decl
AST: Make the decl associated with an AvailabilityDomain a ValueDecl
2025-08-14 16:54:31 -07:00