Commit Graph

20794 Commits

Author SHA1 Message Date
Slava Pestov
885d221417 Merge pull request #76585 from slavapestov/small-subst-cleanups-2
More type substitution cleanups
2024-09-20 15:59:04 -04:00
Arnold Schwaighofer
f1a64571fb Merge pull request #76579 from aschwaighofer/async_frame_pointer_all_option
IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
2024-09-20 10:43:59 -07:00
Slava Pestov
4bb8f46d6d Merge pull request #76536 from slavapestov/small-subst-cleanups
Tiny optimization and cleanups
2024-09-19 21:36:51 -04:00
Sima Nerush
952ae45b3c Merge pull request #76395 from simanerush/global-actor-cut-off-119628202
[Concurrency] Allow `nonisolated` to prevent global actor inference.
2024-09-19 14:58:15 -07:00
Doug Gregor
6039df3a34 Merge pull request #76565 from DougGregor/remove-if-config
Remove IfConfigDecl from the AST
2024-09-19 13:49:03 -07:00
Arnold Schwaighofer
b49e30c01b IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
`-Xfrontend -enable-async-frame-pointer-all`

rdar://135746607
2024-09-19 12:28:57 -07:00
Slava Pestov
a911693c8c AST: PackConformance::getAssociatedType() => getTypeWitness() 2024-09-19 14:18:34 -04:00
Slava Pestov
26241a50f3 AST: Remove DependentMemberType::substBaseType() 2024-09-19 14:18:33 -04:00
Slava Pestov
508dacc3a2 AST: Add ProtocolConformanceRef::getTypeWitness() 2024-09-19 14:18:33 -04:00
Slava Pestov
532e048abb AST: Remove DependentMemberType::substRootParam() 2024-09-19 14:18:32 -04:00
Sima Nerush
40185cce2a [Concurrency] Allow nonisolated to be used on protocols, extensions, classes, structs, and enums. 2024-09-19 10:09:11 -07:00
Michael Gottesman
fb281331b3 Merge pull request #76558 from gottesmm/pr-39b63781333d46b16f086a7c192efc67b26255db
[concurrency] Behind the flag UnspecifiedMeansMainActorIsolated, try inferring by default main actor isolation instead of nonisolated for unspecified.
2024-09-19 09:18:33 -07:00
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Michael Gottesman
3843899c19 [concurrency] Behind the flag UnspecifiedMeansMainActorIsolated, try inferring by default main actor isolation instead of nonisolated for unspecified.
Just to play with.
2024-09-18 13:23:23 -07:00
Doug Gregor
3a570e060c Merge pull request #76551 from DougGregor/one-loc-to-file-lookup
Reimplement ModuleDecl::getSourceFileContainingLocation() using SourceManager
2024-09-18 12:55:08 -07:00
Doug Gregor
da0c70f301 Merge pull request #76512 from DougGregor/sourcefile-nonopt-buffer
Ensure that SourceFiles always have a backing buffer in the SourceManager
2024-09-18 10:54:52 -07:00
Pavel Yaskevich
43e19358d7 Merge pull request #76458 from xedin/rdar-131347583
[Concurrency] Allow global actor mismatches while overriding `@precon…
2024-09-18 09:16:57 -07:00
Doug Gregor
8febd3fb32 Reimplement ModuleDecl::getSourceFileContainingLocation() using SourceManager
ModuleDecl kept track of all of the source files in the module so that it
could find the source file containing a given location, which relied on
a sorted array all of these source files. SourceManager has its own
similar data structure for a similar query mapping the locations to
buffer IDs.

Replace ModuleDecl's dats structure with a use of the SourceManager's version
with the mapping from buffer IDs to source files.
2024-09-18 07:45:50 -07:00
Gábor Horváth
ffa1014c30 Merge pull request #76311 from swiftlang/gaborh/import-lifetimebound
[cxx-interop] Teach importer to interpret lifetimebound annotations
2024-09-18 15:24:32 +01:00
Gabor Horvath
16e012bb5e [cxx-interop] Teach importer to interpret lifetimebound annotations
The lifetimebound annotations are now imported as lifetime dependencies.
This works for basic cases but there are still some parts missing:
* Support lifeitmebound annotations on constructors
* A way to represent immortal/static lifetimes on the C++ side
2024-09-18 10:51:05 +01:00
Slava Pestov
ad68d22041 Merge pull request #76518 from slavapestov/fix-issue-76513
Concurrency: Reject nonisolated lazy properties
2024-09-17 15:11:39 -04:00
Slava Pestov
46b4983baf Concurrency: Reject nonisolated lazy properties
We already banned nonisolated property wrappers, and 'lazy' is
conceptually similar, so it makes sense to disallow it also.

Fixes https://github.com/swiftlang/swift/issues/76513.
2024-09-17 11:30:44 -04:00
Saehej Kang
6c92f3fe1c [Diag]: Result builder misplacement error message mentions subscript 2024-09-17 02:45:07 -07:00
Doug Gregor
49aa0e966f Ensure that SourceFiles always have a backing buffer in the SourceManager
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.

Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.

Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
Doug Gregor
05e8140c6d Provide macro module name in MacroExpansionExpr creation
This properly passes the module name through from attached macros to
the freestanding macro that are used under-the-hood for type checking.
2024-09-16 16:44:17 -07:00
Meghana Gupta
58c6a2fb31 Merge pull request #76455 from meg-gupta/enablestdlib
Enable NonEscapableTypes in standard library and make the feature suppressible
2024-09-16 11:52:41 -07:00
Slava Pestov
f35c90a6b7 Merge pull request #76445 from slavapestov/maptypeintocontext
Overhaul mapTypeIntoContext()
2024-09-14 08:45:20 -04:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
Meghana Gupta
68bfc0d3b4 Make NonEscapableTypes as a suppressible experimental feature 2024-09-13 13:13:17 -07:00
Slava Pestov
4afdc9d0bf AST: Lazily map archetype superclass into context
We don't really want to support this, at least not yet, but there
are ways to sneak it past the diagnostic that are hard to close.

Fixes rdar://problem/135348472.
2024-09-13 15:34:48 -04:00
Slava Pestov
08bb0017f5 AST: Add GenericSignatureImpl::getReducedTypeParameter()
This avoids a bit of indirection when the input is already known to be
a type parameter, and not just a type that contains type parameters.
2024-09-13 15:19:48 -04:00
Slava Pestov
be9d999e64 AST: Simplify GenericSignature::getLocalRequirements() 2024-09-13 15:19:48 -04:00
Slava Pestov
4923521227 AST: Re-implement GenericEnvironment::mapTypeIntoContext() using TypeTransform 2024-09-13 15:19:48 -04:00
Arnold Schwaighofer
8e9cd5db68 Merge pull request #76150 from aschwaighofer/async_entry_ret_metadata
IRGen: Add metadata for async funclets denoting frame entry and frame exists
2024-09-13 11:52:00 -07:00
Pavel Yaskevich
22b9dd7f7b [Concurrency] Allow global actor mismatches while overriding @preconcurrency members in Swift 5 mode
Downgrade a mismatch on global actor attributes to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable members.

Resolves: rdar://131347583
2024-09-13 11:28:47 -07:00
Slava Pestov
a19ee6366e AST: Remove useless overload of GenericEnvironment::mapTypeIntoContext() 2024-09-13 08:12:51 -04:00
Allan Shortlidge
07357b9c1f Merge pull request #76431 from rjmansfield/remove-more-unused-diags
Remove additional unused diagnostics.
2024-09-12 20:16:50 -07:00
Kavon Farvardin
ba0aac3f39 Merge pull request #76093 from kavon/coldsplit-2
ColdBlockInfo: overhaul analysis pass
2024-09-12 16:06:07 -07:00
Alejandro Alonso
718bba486a Merge pull request #76404 from Azoy/integer-type-parsing-fixes
[Parse] Fix type parsing when preceded by '-'
2024-09-12 09:26:57 -07:00
Ryan Mansfield
a097f9f660 Remove additonal unused diagnostics.
Also fix typo in diagnostics verifier error message.
2024-09-12 12:04:54 -04:00
Allan Shortlidge
23e9719b2b Sema: Refactor "cannot be marked unavailable" diagnostics.
Make it possible to share the diagnostics string for common case.
2024-09-11 16:42:47 -07:00
Doug Gregor
b272a05ea9 Merge pull request #76363 from DmT021/wp/print-diagnostic-groups
[Diagnostics] Add -print-diagnostic-groups flag
2024-09-11 13:04:07 -07:00
Becca Royal-Gordon
4dae9eea5a Merge pull request #76270 from beccadax/objcimpl-serialization-2 2024-09-11 10:53:17 -07:00
Alejandro Alonso
6f83e3c28f Fix type parsing when preceeded by '-' 2024-09-11 10:28:44 -07:00
fahadnayyar
7753ad0885 Merge pull request #76131 from fahadnayyar/cxx-interop-frt-retain-release-diagnostics
Fixed diagnostics for incorrect parameters of retain/release function…
2024-09-11 10:24:20 -07:00
Dmitrii Galimzianov
a8b71ea97f Add -print-diagnostic-groups flag
This change adds the `-print-diagnostic-groups` flag as described by SE-0443.
2024-09-11 13:34:42 +02:00
Doug Gregor
4bdf601c3b Merge pull request #76382 from DmT021/wp/diag-groups-typos
[Diagnostics] Fix typos and flag names
2024-09-11 01:49:23 -07:00
Meghana Gupta
0dde044e89 Merge pull request #76256 from meg-gupta/lifetimeattrsyntax
Introduce @lifetime attribute to specify lifetime dependence on function declarations
2024-09-10 19:49:32 -07:00
Alexis Laferrière
2aabffa8a0 Merge pull request #76358 from xymus/authoritative-import
Sema: Pick the most relevant import for diagnostics about the source of a decl
2024-09-10 16:25:06 -07:00
fahadnayyar
f3f4e1913b Fixed diagnostics for incorrect signature of retain/release functions of SWIFT_SHARED_REFERENCE C++ types. 2024-09-10 16:15:07 -07:00