Commit Graph

22239 Commits

Author SHA1 Message Date
Pavel Yaskevich
47684cb2a1 Revert "AST: Re-enable TypeSubstituter::transformSubstitutionMap() again"
This reverts commit 81bf4490ae.
2025-08-22 13:59:31 -07:00
Egor Zhdan
2409e33928 [cxx-interop] Fix an assertion for extern "C" blocks
rdar://158896622 / resolves https://github.com/swiftlang/swift/issues/83861
2025-08-22 17:51:38 +01:00
Michael Gottesman
05536d7183 [ast] Convert swift::getBuiltinType to use a covered switch for BuiltinTypeKind.
This is an NFC change. The idea is that this will make it easier to add new
BuiltinTypeKinds. I missed this code when adding Builtin.ImplicitIsolationActor.
By adding a covered switch, we can make sure this code is updated in the
future.
2025-08-21 12:36:01 -07:00
swift-ci
161fd8bea5 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-20 11:02:07 -07:00
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
Anthony Latsis
44c480e83b Mnually merge main -> rebranch
Conflicts:
* `lib/ClangImporter/ClangModuleDependencyScanner.cpp`:
  https://github.com/swiftlang/swift/commit/5e09125
*	`utils/build.ps1`: https://github.com/swiftlang/swift/pull/83523
2025-08-19 21:51:34 +01:00
Alexis Laferrière
b624ee96fe AST: Introduce EnumDecl::isCDeclEnum and isCCompatibleEnum 2025-08-19 13:40:09 -07: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
Allan Shortlidge
5ae0ad6a8f AST: Allow obsoletion in Swift version to disambiguate overloads consistently.
It must be possible to disambiguate overloads using the module-wide Swift
language version, even in contexts that are themselves obsolete in the current
Swift language version.

Resolves rdar://158620835.
2025-08-18 17:20:42 -07:00
Kuba Mracek
7b0eff8616 [ClangImporter] Skip importing values for ObjCBool declarations 2025-08-18 10:16:51 -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
swift-ci
fd22790987 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-18 05:56:12 -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
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
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
92e6a00056 [Diags] Avoid infinite recursion on decl printing request cycle
The ASTPrinter may kick requests that may emit diagnostics, make sure
we don't attempt to recursively print the decl since that would lead
to infinite recursion when diagnosing the cycle.
2025-08-17 11:48:21 +01:00
swift-ci
837895af84 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 06:13:25 -07: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
swift-ci
ab9176fa4b Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 02:24:41 -07:00
Gábor Horváth
16fbfec493 Merge pull request #83754 from Xazax-hun/reenable-addressable-params 2025-08-16 09:17:46 +01: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
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
Slava Pestov
dd41eeba5e AST: Clean up TypeBase::adjustSuperclassMemberDeclType() 2025-08-15 18:37:12 -04: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
swift-ci
c0223fb423 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-15 12:15:24 -07:00
Slava Pestov
8007295715 AST: Introduce TypeBase::replaceDynamicSelfType() 2025-08-15 14:40:39 -04:00
Egor Zhdan
f96a5e5b2b Merge pull request #83589 from egorzhdan/egorzhdan/reland-extern-namespace
Revert "Revert "[cxx-interop] Import decls in extern blocks within namespaces""
2025-08-15 18:30:51 +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
swift-ci
ec2a539ee6 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-15 01:15:19 -07: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
swift-ci
fdc5b2bc73 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 19:55:30 -07: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
Mykola (Nickolas) Pokhylets
31470bbd1e Merge pull request #82732 from nickolas-pohilets/mpokhylets/weak-let-feature
Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved
2025-08-14 23:59:28 +02:00
Slava Pestov
3dcadf8bb0 AST: Add typeCheckFunctionBodies parameter to ReplaceOpaqueTypesWithUnderlyingTypes 2025-08-14 17:01:47 -04:00
Slava Pestov
24ee8cf681 AST: Add typeCheckFunctionBodies parameter to getUniqueUnderlyingTypeSubstitutions() 2025-08-14 17:01:47 -04:00
Allan Shortlidge
0bba9bbc26 AST: Make the decl associated with an AvailabilityDomain a ValueDecl.
A decl that represents an `AvailabilityDomain` should always be a `ValueDecl`.
2025-08-14 11:35:00 -07:00
swift-ci
b8e081b7f3 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 09:16:13 -07:00
Andrew Trick
44bd40dd5c Merge pull request #83690 from atrick/fix-infer-subscript
Lifetime inference: implicit subscript getter depenency + implicit _modify
2025-08-14 09:03:36 -07:00
swift-ci
e93ab979eb Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 05:15:47 -07:00
Allan Shortlidge
93902835d0 AST: Allow overloads to be disambiguated by obsoletion version.
Previously, whether a declaration is unavailable because it is obsolete was
determined based solely on the deployment target and not based on contextual
availability. Taking contextual availability into account makes availability
checking more internally consistent and allows library authors to evolve APIs
by obsoleting the previous declaration while introducing a new declaration in the
same version:

```
@available(macOS, obsoleted: 15)
func foo(_ x: Int) { }

@available(macOS, introduced: 15)
func foo(_ x: Int, y: Int = 0) { }

foo(42) // unambiguous, regardless of contextual version of macOS
```

This change primarily accepts more code that wasn't accepted previously, but it
could also be source breaking for some code that was previously allowed to use
obsoleted declarations in contexts that will always run on OS versions where
the declaration is obsolete. That code was clearly taking advantage of an
availabilty loophole, though, and in practice I don't expect it to be common.

Resolves rdar://144647964.
2025-08-13 11:26:07 -07:00
Andrew Trick
52b990a008 Lifetime inference: fix a crash on implicit _modify for subscripts.
Fixes rdar://155976839 (Compiler crash when _modify is not specified for
~Escapable type)
2025-08-12 22:02:17 -07:00
Andrew Trick
60ce851d21 Lifetime inference: give subscripts an implicit dependency on 'self'
Allow a subscript getter to return a non-Escapable type without an explicit
'@'lifetime annotation.

    subscript(_ index: Int) -> Span {
      get {} // OK
    }
2025-08-12 22:02:17 -07:00
swift-ci
78dcb4dd45 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-12 03:16:32 -07:00
Allan Shortlidge
600e971b40 AST: Revert disambiguation of overloads by obsoletion version.
It caused a regression when building the CloudKit module from its interface in
the Xcode 26 SDKs.

This effectively reverts https://github.com/swiftlang/swift/pull/83384 (though
a few parts of that PR that did not cause any regressions have been kept).

Resolves rdar://157342004.
2025-08-11 21:50:40 -07:00
Allan Shortlidge
a2aa3364b7 Merge pull request #83655 from tshortli/module-version-missing-warning-group
AST: Introduce a warning group for a versioned `#if canImport` diagnostic
2025-08-11 21:11:31 -07:00
Artem Chikin
9af480d81f Merge pull request #83306 from artemcm/NoMoreCopyAllDependencies
[Dependency Scanning] Reduce the amount of copying of collections of module IDs
2025-08-11 17:19:35 -07:00
swift-ci
a82d1c8179 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-11 16:55:50 -07:00
Allan Shortlidge
dacd986f1b AST: Introduce a warning group for a versioned #if canImport diagnostic.
This allows developers to control whether these diagnostics are considered
errors when `-warnings-as-errors` is specified.

Resolves rdar://157694667.
2025-08-11 16:06:06 -07:00
Artem Chikin
56a6c14ba0 [Dependency Scanning] Reduce the amount of copying of collections of module IDs
Previously, frequently-used methods like 'getAllDependencies' and 'getAllClangDependencies' had to aggregate (copy) multiple collections stored in a 'ModuleDependencyInfo' into a new result array to present to the client. These methods have been refactored to instead return an iterable joined view of the constituent collections.
2025-08-11 12:18:56 -07:00
Hamish Knight
9d9b4c90c6 [Sema] Sink Pattern invalidation into SyntacticElementTarget::markInvalid
Rather than handling this in the callers of `typeCheckExpression`,
handle it in the constraint system's invalidation logic. This also
ensures we set a type for sub-pattern nodes.
2025-08-11 12:05:10 +01:00