Commit Graph

21976 Commits

Author SHA1 Message Date
Hamish Knight
b90494b9ec Merge pull request #83985 from hamishknight/null-ext
[ASTDumper] Check null for `getExtendedTypeRepr`
2025-08-29 02:34:18 +01:00
Kavon Farvardin
bb8b1e1b42 Merge pull request #83984 from kavon/avoid-not-noncopyable
nfc: avoid !isNoncopyable()
2025-08-28 17:46:39 -07:00
Slava Pestov
161c6f5692 Revert "Revert "AST: Re-enable TypeSubstituter::transformSubstitutionMap() again""
This reverts commit 47684cb2a1.
2025-08-28 16:52:11 -04:00
Slava Pestov
672135b053 AST: Remove old hack that appears to be obsolete
The FIXME was originally introduced in 2017 by commit c0805a2bc8.

Good riddance!
2025-08-28 16:51:49 -04:00
Hamish Knight
dfc940f82d [ASTDumper] Check null for getExtendedTypeRepr
This can be null for `extension {}`.
2025-08-28 20:46:16 +01:00
Kavon Farvardin
3bb8fa848a nfc: !isNoncopyable() -> isCopyable() 2025-08-28 12:13:21 -07:00
Kavon Farvardin
19c68332b0 nfc: introduce TypeBase::isCopyable
The days of double-negative conditions is over.
2025-08-28 12:13:11 -07:00
Slava Pestov
a5a8cf4a36 Merge pull request #83858 from slavapestov/covariant-result-type-part-2
AST: Continue process of removing replaceCovariantResultType()
2025-08-28 10:07:13 -04:00
Allan Shortlidge
b11ccb60ef Merge pull request #83964 from tshortli/module-interface-parameter-property-wrappers
ModuleInterface: Only print API-level property wrappers in swiftinterfaces
2025-08-28 06:26:29 -07:00
Konrad Malawski
c1491c8022 [Concurrency/Distributed] nonisolated-nonsending by default breaks distributed thunks
the new NonisolatedNonsendingByDefault upcoming feature breaks remote
calls in distributed actors, because the expected isolation doesn't
match and the runtime swift_distributed_execute_target_resume will
crash.

This is a short term fix to unblock adopters, however preferably we
should mark the thunks as nonisolated(nonsending), though that seems to
be more involved.

resolves rdar://159247975
2025-08-28 21:53:41 +09:00
Allan Shortlidge
441132426f ModuleInterface: Only print API-level property wrappers in swiftinterfaces.
When a function parameter has attached property wrappers (SE-0293) those
property wrappers are either considered "implementation" or "API" level.
Property wrappers that are implementation-level don't affect how the function
is called and therefore shouldn't be included in swiftinterfaces unless the
function's body is also printed.

Resolves rdar://156711817.
2025-08-27 21:35:20 -07:00
Slava Pestov
1716832a7a AST: Remove most usages of AbstractFunctionDecl::hasDynamicSelfResult() 2025-08-27 15:34:26 -04:00
Slava Pestov
e8ec5befa6 AST: Remove a usage of replaceCovariantResultType() 2025-08-27 15:34:25 -04:00
Slava Pestov
9e0dbb923a AST: Add TypeBase::withCovariantReturnType() 2025-08-27 15:34:25 -04:00
Hamish Knight
7e22297b71 [AST] Walk ErrorExpr's original expr in ASTWalker
We set an original expression on ErrorExpr for cases where we have
something semantically invalid that doesn't fit into the AST, but is
still something that the user has explicitly written. For example
this is how we represent unresolved dots without member names (`x.`).
We still want to type-check the underlying expression though since
it can provide useful diagnostics and allows semantic functionality
such as completion and cursor info to work correctly.

rdar://130771574
2025-08-27 15:27:06 +01:00
Hamish Knight
b063947b37 [AST] Include ErrorExpr's original expr in ASTDumper 2025-08-27 15:20:33 +01:00
Allan Shortlidge
ee4fd56ab3 Merge pull request #83910 from tshortli/custom-availability-domain-access-checking
Sema: Check access, availability, and exportability of availability domains
2025-08-26 13:55:17 -07:00
Allan Shortlidge
9de88624b2 Sema: Diagnose availability of availability domains in if #available queries.
When emitting statement diagnostics for `if #available` queries, diagnose the
availability of the decls representing the referenced availability domains.
Among other things, this checks that the domains are sufficiently visible to be
used in the containing function body context.
2025-08-26 08:20:12 -07:00
eeckstein
3a8399d4e1 Merge pull request #83900 from eeckstein/fix-sil-printer
SIL: fix printing of dependent existential archetypes
2025-08-26 08:01:44 +02:00
Michael Gottesman
0b75992eba Merge pull request #83853 from gottesmm/pr-21e0361deb74f2e659fa9c4c8e4f4d001d80c141
[ast] Convert swift::getBuiltinType to use a covered switch for BuiltinTypeKind
2025-08-25 14:48:52 -07:00
Erik Eckstein
833560f08f SIL: fix printing of dependent existential archetypes
We were missing parentheses:
```
  $@opened("...", any P2) Self.A
```
->
```
  $(@opened("...", any P2) Self).A
```
2025-08-25 19:38:26 +02:00
Janat Baig
798c0f51a4 Merge branch 'main' into temp-branch 2025-08-23 11:11:04 -04:00
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
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
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
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
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
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
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
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
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