swift
[ConstraintSystem] Implement sendability inference for key path expressions
#70076
Merged

[ConstraintSystem] Implement sendability inference for key path expressions #70076

xedin
xedin1 year ago

Gated by InferSendableFromCaptures experimental flag.

Swift forums pitch - https://forums.swift.org/t/pitch-inferring-sendable-for-methods-and-key-path-literals/68011

Sendability of key path expressions is expressed by means of protocol composition
between key path type and Sendable protocol i.e. KeyPath<String, Int> & Sendable.

Augment the key path capability inference to include sendability checking based
on whether subscript component arguments captured by a key path are sendable
or not or, if there are subscript components a key path expression is always sendable.

Resolves: rdar://75861003

xedin [AST] NFC: Rename `KeyPathExpr::{get, set}RootType` to `{get, set}Exp…
1f42585f
xedin [ConstraintSystem] Extend KeyPathCapability to support sendability
2e1ca0a3
xedin [ConstraintSystem] NFC: Adjust comment for `isKnownKeyPath` to cover …
c5d393f0
xedin [AST] Add a way to retrieve key path and its root/value types from `K…
c9a8355c
xedin [SIL] Add a way to retrieve key path type from `KeyPathInst`
229e5801
xedin [CSGen] Any type vars in subscript index arguments should be connecte…
316e8f93
xedin [CSSolver] Handle situations when key path expression has an existent…
d7274956
xedin [ConstraintSystem] InferSendableFromCaptures: Start inferring sendabi…
40c8da66
xedin [TypeChecker] Concurrency: Suppress key path sendability diagnostics …
cfa9905b
xedin xedin added swift evolution pending discussion
xedin xedin requested a review from ktoso ktoso 1 year ago
xedin xedin requested a review from kavon kavon 1 year ago
xedin xedin requested a review from hborla hborla 1 year ago
xedin xedin requested a review from slavapestov slavapestov 1 year ago
xedin xedin requested a review from ahoppen ahoppen 1 year ago
xedin xedin requested a review from bnbarham bnbarham 1 year ago
xedin xedin requested a review from rintaro rintaro 1 year ago
xedin xedin requested a review from hamishknight hamishknight 1 year ago
xedin [TypeChecker] NFC: Add test-cases verify that sendability of key path…
3d6ddd58
xedin xedin force pushed from b3c70efb to 3d6ddd58 1 year ago
xedin
xedin1 year ago

@swift-ci please test

xedin
xedin1 year ago

@swift-ci please test source compatibility

xedin
xedin1 year ago

@swift-ci please test Linux platform

ahoppen ahoppen removed review request from ahoppen ahoppen 1 year ago
xedin [Sema/SIL] NFC: Get existential layout directly from an existential type
511dad55
xedin
xedin1 year ago

@swift-ci please test

xedin
xedin1 year ago

@swift-ci please test Linux platform

xedin xedin merged 4db2cf7b into main 1 year ago

Login to write a write a comment.

Login via GitHub

Assignees
No one assigned
Labels
Milestone