Commit Graph

22239 Commits

Author SHA1 Message Date
swift-ci
ce0f17aeac Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 21:35:40 -07:00
Henrik G. Olsson
7fcc72f108 Merge pull request #81859 from swiftlang/swiftify-inherit-imports
[MacrosOnImports][Swiftify] Copy module imports from clang node's module to its Swift macro SourceFile
2025-09-19 21:21:09 -07:00
swift-ci
9be21897d9 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 15:20:12 -07:00
Hamish Knight
46df852610 [Sema] Reject placeholders in type resolution for param and result types
Not all clients can properly handle the presence of placeholders in
interface types and it doesn't seem worth the complexity for the 
type replacement diagnostic.
2025-09-19 14:22:39 +01:00
Hamish Knight
b39dfdf416 [AST] Upgrade interface type assertions 2025-09-19 14:22:39 +01:00
swift-ci
ca93b4b068 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 16:17:26 -07:00
Kavon Farvardin
84cf0a3551 Merge pull request #81858 from kavon/kavon/manual-ownership
introduce @_manualOwnership performance attribute
2025-09-18 16:15:20 -07:00
swift-ci
7b8b46694b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 06:36:53 -07:00
Hamish Knight
deab5f7970 Merge pull request #84280 from hamishknight/csapply-cleanup
Reapply: [Sema] Remove some unreachable code from CSApply
2025-09-18 14:25:51 +01:00
swift-ci
9e3d4161b5 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 05:03:55 -07:00
Kavon Farvardin
61fe8a9b8e introduce @_manualOwnership performance attribute
This attribute forces programmers to acknowledge every
copy that is required to happen in the body of the
function. Only those copies that make sense according
to Swift's ownership rules should be "required".

The way this is implemented as of now is to flag each
non-explicit copy in a function, coming from SILGen, as
an error through PerformanceDiagnostics.
2025-09-17 13:51:57 -07:00
Hamish Knight
5e1acf5d32 [AST] Preserve HasPlaceholder recursive property for GenericFunctionType 2025-09-17 20:41:20 +01:00
Slava Pestov
90bfc1676d Sema: Remove some unreachable code from CSApply
I believe these code paths could only be reached by re-typechecking
invalid code in the old CSDiag implementation.
2025-09-17 16:11:53 +01:00
Henrik G. Olsson
17c0e564e8 Add hidden --dump-source-file-imports flag
This flag dumps all imports for each SourceFile after it's gone through
import resolution. It is only intended for testing purposes.
There are other ways to print imports, but they don't correspond 1:1 to
the imports actually resolved, which is a bit problematic when testing
implicit clang module imports.
2025-09-16 21:09:59 -07:00
swift-ci
efdca7809a Merge remote-tracking branch 'origin/main' into rebranch 2025-09-16 15:42:34 -07:00
Allan Shortlidge
4841bcffa1 ModuleInterface: Print imports with @preconcurrency in swiftinterface files.
When a module has been imported `@preconcurrency` in source, when it is printed
in a `swiftinterface` file it should be printed along with the attribute to
ensure that type checking of the module's public declarations behaves
consistently.

This fix is a little unsatisfying because it adds another a linear scan over
all imports in the source for each printed import. This should be improved, but
it can be done later.

Resolves rdar://136857313.
2025-09-15 17:33:13 -07:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
swift-ci
09d0324a71 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 01:41:51 -07:00
Hamish Knight
411e14d00b Merge pull request #84275 from hamishknight/skippy
[CS] Avoid skipping SingleValueStmtExpr branch with ReturnStmt for completion
2025-09-15 09:33:17 +01:00
Hamish Knight
f1ad703430 [CS] Avoid skipping SingleValueStmtExpr branch with ReturnStmt for completion
We still need to solve a branch with a ReturnStmt to avoid leaving
the contextual result type unbound. This isn't currently legal anyway,
so isn't likely to come up often in practice, but make sure we can
still solve.
2025-09-13 19:15:34 +01:00
swift-ci
bf9d79f5c1 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-13 06:17:00 -07:00
Slava Pestov
6bf5213d41 Merge pull request #84251 from slavapestov/fix-rdar151171381
Fix @_opaqueReturnTypeOf module interface syntax for parameter packs
2025-09-13 08:44:44 -04:00
Hamish Knight
8e460d1e6c Merge pull request #84225 from hamishknight/access-noted
Requestify the loading of access notes
2025-09-13 12:06:43 +01:00
swift-ci
edf0c5fffd Merge remote-tracking branch 'origin/main' into rebranch 2025-09-12 21:14:20 -07:00
Henrik G. Olsson
8e802be2b8 Merge pull request #81663 from hnrklssn/swiftify-debug-logging
[Swiftify] add debug logs for safe interop
2025-09-12 18:40:55 -07:00
Henrik G. Olsson
ea5a41ea68 [ASTPrint] Only print CustomAttr arglist if PrintExprs enabled
The argument list is going to be mostly empty if PrintExprs is not
enabled. Always trying to print the arguments also broke quite a few
tests, because it would result in a mismatch between the swift interface
before and after serialization, since CustomAttr arguments are not
serialized.
2025-09-12 12:53:59 -07:00
Slava Pestov
87cbb7d2d0 AST: New way of printing @_opaqueReturnTypeOf when parameter packs are involved
This is the ASTPrinter change to go with the Sema change.
We now print @_opaqueReturnTypeOf using the new nested
syntax when parameter packs are involved.

Fixes rdar://problem/151171381.
2025-09-12 15:43:30 -04:00
swift-ci
7b9382146f Merge remote-tracking branch 'origin/main' into rebranch 2025-09-12 10:55:53 -07:00
Hamish Knight
014ed51ab1 Merge pull request #84220 from hamishknight/times-arrow
[AST] Allow storing original expression in `ErrorTypeRepr`
2025-09-12 17:06:34 +01:00
swift-ci
66c8ef9205 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 20:55:58 -07:00
Allan Shortlidge
0ba825e5f2 Merge pull request #84240 from tshortli/always-enabled-availability-domains
AST: Introduce an "always enabled" custom availability domain kind
2025-09-11 20:43:28 -07:00
Slava Pestov
bd3b3ea009 ASTDemangler: Split off resolveOpaqueTypeDecl() from resolveOpaqueType() 2025-09-11 22:55:10 -04:00
Henrik G. Olsson
149828f019 [ASTPrint] Print argument list for CustomAttr 2025-09-11 18:46:22 -07:00
Henrik G. Olsson
f2d3faefd6 [ASTPrint] Refactor CustomAttr printing (NFC)
This is a pure refactor to enable using PrintAST in the next commit.
2025-09-11 18:46:22 -07:00
swift-ci
64aaf36dc5 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 17:58:46 -07:00
Slava Pestov
59e8fdebbb Merge pull request #84209 from slavapestov/fix-rdar159790557
RequirementMachine: Fix crash-on-invalid with concrete type requirements involving packs
2025-09-11 20:23:38 -04:00
Allan Shortlidge
d2682f7c32 AST: Import "always enabled" availability domains from Clang.
Resolves rdar://157593409.
2025-09-11 14:39:18 -07:00
Allan Shortlidge
0647da5416 AST: Introduce an "always enabled" custom availability domain kind.
An always enabled availability domain is implicitly available in all contexts,
so uses of declarations that are marked as `@available` in the domain are never
rejected. This is useful for an availability domain representing a feature flag
that has become permanently enabled.

Partially resolves rdar://157593409.
2025-09-11 14:39:05 -07:00
Hamish Knight
5c334c5f21 Requestify the loading of access notes
Replace `loadAccessNotesIfNeeded` with a request that loads the access
notes on-demand.
2025-09-11 16:54:08 +01:00
swift-ci
48eb65ee53 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 08:04:53 -07:00
Slava Pestov
79035e99f0 Merge pull request #84210 from slavapestov/remove-has-dynamic-self-result
AST: Remove AbstractFunctionDecl::hasDynamicSelfResult()
2025-09-11 08:45:08 -04:00
Hamish Knight
c84d2abb05 [AST] Allow storing original expression in ErrorTypeRepr
This is useful for ArrowExpr when the sub-expressions aren't valid
TypeExprs. Rather than throwing away the AST, attach it to the
ErrorTypeRepr to ensure we can still type-check it. This ensures
semantic functionality still works correctly, and fixes a crash where
we'd stop visiting an invalid binding pattern, losing track of the
nested VarDecl.
2025-09-11 13:21:03 +01:00
Hamish Knight
e1bd9038b3 [AST] NFC: Remove DelayedDiag from ErrorTypeRepr
This is no longer used.
2025-09-11 13:21:03 +01:00
Slava Pestov
0507b02024 RequirementMachine: Fix crash-on-invalid with concrete type requirements involving packs
We would crash in some cases, or produce a slightly misleading
diagnostic about same-element requirements, which are related but
not quite the same.

In the fullness of time, we should figure out this corner of the
language. Until then, add a new diagnostic since this is really
about same-type requirements between concrete types and packs.

Fixes rdar://159790557.
2025-09-10 20:20:31 -04:00
swift-ci
bbf89c6e27 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-10 16:58:24 -07:00
Hamish Knight
b43609fc4c Merge pull request #84204 from hamishknight/alloc-less 2025-09-11 00:52:49 +01:00
Slava Pestov
507f7617ea AST: Remove AbstractFunctionDecl::hasDynamicSelfResult() 2025-09-10 19:26:02 -04:00
Hamish Knight
ea42ecf2bf [AST] NFC: Remove an unnecessary allocation
I missed this when changing the case body vars to be tail allocated,
remove the use of `AllocateCopy`.
2025-09-10 17:07:57 +01:00
swift-ci
f22ddb12f6 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-10 06:55:39 -07:00