Commit Graph

1687 Commits

Author SHA1 Message Date
Pavel Yaskevich
cda9866b26 [CSGen] Prevent @concurrent on closures from skipping throws inference
Introduction of `@concurrent` attribute caused an unintended
side-effect in `ClosureEffectsRequest` since the attribute
could only be used on `async` types setting `async` too early
prevented body analysis for `throws` from running.

Resolves: rdar://151421590
2025-05-15 17:17:02 -07:00
Alejandro Alonso
e68b398d41 Rename isArrayType and split the InlineArray portion 2025-04-29 15:57:10 -07:00
Anthony
c9b17383c8 Grammatical corrections for compound modifiers 2025-04-24 09:21:32 +02:00
Nate Chandler
347689fb30 [NFC] AST: Extract helper method.
Several callers of `AbstractStorageDecl::getAccessStrategy` only cared
about whether the the access would be via physical storage.  Before
adding more arguments to `getAccessStrategy` for which such callers
would have to pass a sentinel value, add a convenience method for this.
2025-04-15 20:45:37 -07:00
Pavel Yaskevich
07ff063ae3 [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-11 15:59:25 -07:00
Pavel Yaskevich
2704ab7337 [AST/ASTGen] Introduce @concurrent attribute to replace @execution(concurrent) spelling 2025-04-11 12:08:29 -07:00
Slava Pestov
00766f7deb AST: Remove type parameter from ProtocolConformanceRef::getTypeWitnessByName() 2025-04-03 17:35:32 -04:00
Slava Pestov
91503710bc AST: Remove origType parameter from ProtocolConformanceRef::getTypeWitness() 2025-04-03 17:35:32 -04:00
Pavel Yaskevich
62d19c5d45 [ConstraintSystem] Use findSelectedOverloadFor in isArgumentGenericFunction
Fixes a crash when existing logic cannot properly determine whether
argument is resolved or not.

Instead of ad-hoc code that checks `ResolvedOverloads` directly, let's
use a method that would reach of a callee locator to determine whether
argument is a reference to a generic function or not.

Resolves: rdar://137825558
2025-03-28 00:41:13 -07:00
Hamish Knight
c597023d38 [CS] Map caught error type into context
Factor out `ConstraintSystem::getExplicitCaughtErrorType` from 
`getCaughtErrorType`. Then use this for the contextual
type for a `throw` syntactic element.

rdar://139000351
2025-03-24 20:08:43 +00:00
Amritpan Kaur
0e895c6a2b [CSApply] Solve keypath methods and initializers. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
c059d1521d [ConstraintSystem] Evaluate capabilities for keypath type. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
2583da94b2 [NFC] Generalize subscript index handling. 2025-03-19 08:53:18 -07:00
Amritpan Kaur
811d54901b [NFC] Rename unresolvedProperty to unresolvedMember
to generalize for both properties and method members.
2025-03-19 08:53:18 -07:00
Amritpan Kaur
8f71f5c780 [NFC] Rename property to member to generalize
for both properties and method members.
2025-03-19 08:53:18 -07:00
Allan Shortlidge
2dd544a73c AST/Sema: Sink AvailabilityContext for location queries from Sema to AST. 2025-03-15 23:47:29 -07:00
Pavel Yaskevich
00af0eeb0f Merge pull request #79975 from xedin/execution-attr-on-closures
[Concurrency] Extend `@execution(...)` attribute support to closures
2025-03-13 09:25:19 -07:00
Pavel Yaskevich
570eedbdc7 [ConstraintSystem] Update closure inference to support @execution(...) attribute
- Update `ClosureEffectsRequest` to make sure that closure is
marked as `async` when `@execution(...)` attribute is present.

- Update `inferClosureType` to set isolation based on an explicit
`@execution(...)` attribute attached to a closure.
2025-03-12 18:08:53 -07:00
eeckstein
47b449372e Merge pull request #79917 from eeckstein/rename-opened-archetype-type
AST: rename OpenArchetypeType -> ExistentialArchetypeType
2025-03-12 06:01:10 +01:00
Erik Eckstein
d225c47d25 AST: rename OpenArchetypeType -> ExistentialArchetypeType
NFC
2025-03-11 20:21:46 +01:00
Slava Pestov
6d8b55a9f6 Sema: Split up gatherConstraints() into gatherAllConstraints() and gatherNearbyConstraints()
The two GatherKinds no longer share any implementation, so there's
no point keeping the logic together. Doing this also allows removing
the acceptConstraintFn from gatherAllConstraints(), which further
simplifies depthFirstSearch().
2025-03-11 13:55:40 -04:00
Pavel Yaskevich
157e71a791 Merge pull request #79478 from xedin/sendable-completion-handler-fixes
[TypeChecker/NameLookup] SE-0463: A few fixes for `SendableCompletionHandlers` feature
2025-03-04 09:34:10 -08:00
Hamish Knight
1138bcc800 [Sema] Remove generic environment tracking from StmtChecker
This is no longer necessary now that we use
`mapLocalArchetypesOutOfContext` to assign depths for generic
signatures involving element archetypes.
2025-02-26 12:02:05 +00:00
Pavel Yaskevich
ffbbfb76bc [ConstraintSystem] Strip Sendable while processing AnyObject lookup results
All of the declarations returned by dynamic `AnyObject` lookup
are `@objc` and hence `@preconcurrency` which means that it should
be possible to introduce `@Sendable` and `any Sendable` annotations
without affecting lookup and shadowing behavior.
2025-02-25 15:40:49 -08:00
Slava Pestov
3a01f206c5 Sema: Rename LocatorPathElt::OptionalPayload to ::OptionalInjection 2025-02-25 17:22:41 -05:00
Hamish Knight
c69590fbdd [CS] Clean up pack expansion environment handling a little
- Track environments for `PackExpansionExpr` directly
instead of using a locator.
- Split up the querying and creation of the environment
such that the mismatch logic can be done directly in
CSSimplify instead of duplicating it.
- Just store the environment directly instead of
the shape and UUID.
2025-02-20 21:31:46 +00:00
Hamish Knight
29e9f429e3 [CS] NFC: Rename PackEnvironments -> PackElementExpansions
IMO "environment" is confusable for GenericEnvironment,
make it clearer it's referring to the parent
PackExpansionExpr.
2025-02-20 21:31:46 +00:00
Slava Pestov
668928e591 Merge pull request #79475 from slavapestov/issue-a-retraction
Sema: Clean up odd bit of dead code in binding inference
2025-02-19 23:55:36 -05:00
Slava Pestov
58fdc4f805 Sema: ConstraintGraph::retractFromInference() doesn't need the new fixed type 2025-02-18 17:52:59 -05:00
Holly Borla
34cc3e88b3 Merge pull request #79406 from hborla/type-eraser-availability
[ConstraintSystem] Always choose an available type eraser type.
2025-02-15 10:49:34 -08:00
Holly Borla
8f706b8c60 [ConstraintSystem] Always choose an available type eraser type.
If no available type eraser type exists, do not perform type erasure. If
multiple type erasers exist, choose the least available type eraser type.
Which type eraser to choose is based on the availability of the lexical
context of the erased expression.
2025-02-14 15:01:10 -08:00
Allan Shortlidge
c8d77c64fa Merge pull request #79326 from tshortli/availability-constraint-reason
AST: Split `AvailabilityConstraint` classifications into separate `Reason` and `Kind` enums
2025-02-12 13:56:48 -08:00
Allan Shortlidge
a6b20b3fe5 AST: Re-introduce AvailabilityConstraint::Kind.
Now the Kind enum classifies availability constraints based on their
satisfiablility.

NFC.
2025-02-12 07:20:14 -08:00
Alejandro Alonso
e4fb1f6761 Rename Slab to InlineArray 2025-02-11 10:26:44 -08:00
Michael Gottesman
7e350bb4ce Revert "[concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated."
This reverts commit 0cb64638d0.
2025-02-06 14:05:06 -08:00
Michael Gottesman
f05f08c2c0 Revert "[concurrency] Make ActorIsolation::Nonisolated -> CallerIsolationInheriting and delete CallerIsolationInheriting."
This reverts commit 543b1e6ca3.
2025-02-06 14:04:30 -08:00
Michael Gottesman
543b1e6ca3 [concurrency] Make ActorIsolation::Nonisolated -> CallerIsolationInheriting and delete CallerIsolationInheriting. 2025-02-03 10:56:08 -08:00
Michael Gottesman
0cb64638d0 [concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated.
This is just the first part of a larger transition.
2025-02-03 10:56:06 -08:00
Slava Pestov
5b4218c38d Revert "Sema: Remove ConstraintKind::OneWayEqual"
This reverts commit 385d66f24e.
2025-02-02 00:43:15 -05:00
Slava Pestov
99595e615e Revert "Sema: Split up gatherConstraints() into gatherAllConstraints() and gatherNearbyConstraints()"
This reverts commit 2230c3a17e.
2025-02-02 00:43:15 -05:00
Anthony Latsis
a84dfc8387 [Gardening] Fix some set but not used variables 2025-01-30 21:34:38 +00:00
Slava Pestov
2230c3a17e Sema: Split up gatherConstraints() into gatherAllConstraints() and gatherNearbyConstraints()
The two GatherKinds no longer share any implementation, so there's
no point keeping the logic together. Doing this also allows removing
the acceptConstraintFn from gatherAllConstraints(), which further
simplifies depthFirstSearch().
2025-01-27 10:27:00 -05:00
Alejandro Alonso
f76d841540 Rename to Slab 2025-01-09 10:39:45 -08:00
Alejandro Alonso
61702fb813 Implement Vector literals 2025-01-08 10:35:55 -08:00
Pavel Yaskevich
8f7e71aa97 Merge pull request #78487 from xedin/Sendable-to-Any-for-lvalues
[CSApply] Sendable-to-Any: Add support for l-value to l-value and inout unsafe casts
2025-01-08 09:57:02 -08:00
Pavel Yaskevich
79f6b07961 [CSApply] Mark self parameter as inout when base/self match on deep equality
If type equality check fails we need to check whether the types
are the same with deep equality restriction since `any Sendable`
to `Any` conversion is now supported in generic argument positions
of @preconcurrency declarations. i.e. referencing a member on
`[any Sendable]` if member declared in an extension that expects
`Element` to be equal to `Any`.
2025-01-07 10:55:04 -08:00
Slava Pestov
2d17294d73 Merge pull request #78301 from slavapestov/remove-one-way-constraints
Sema: Remove ConstraintKind::OneWayBindParam and ConstraintKind::OneWayEqual
2025-01-05 10:38:14 -05:00
Michael Gottesman
5d4239af57 [concurrency] Add new isolation kind CallerIsolationInheriting.
Right now it is basically a version of nonisolated beyond a few simple cases
like constructors/destructors where we are pretty sure we want to not support
this.

This is part of my bringup strategy for changing nonisolated/unspecified to be
caller isolation inheriting.
2025-01-02 13:18:30 -08:00
Hamish Knight
4cbe481f82 Merge pull request #78377 from hamishknight/no-simplify-result
[CS] Don't simplify `FunctionResult` in `simplifyLocator`
2025-01-02 17:26:22 +00:00
Anthony Latsis
5c24df22a0 Merge pull request #78363 from AnthonyLatsis/dicksonia-arborescens
[NFC] Sema: Tidy up `canOpenExistentialCallArgument`
2025-01-02 15:38:27 +00:00