Skip to content

Commit bb9588e

Browse files
authored
Merge pull request #37593 from DougGregor/se-0313-enable-nonisolated-5.5
2 parents ac8aad3 + 438858b commit bb9588e

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ CHANGELOG
2929
Swift 5.5
3030
---------
3131

32+
* [SE-0313][]:
33+
34+
Declarations inside an actor that would normally by actor-isolated can
35+
explicitly become non-isolated using the `nonisolated` keyword. Non-isolated
36+
declarations can be used to conform to synchronous protocol requirements:
37+
38+
```swift
39+
actor Account: Hashable {
40+
let idNumber: Int
41+
let balance: Double
42+
43+
nonisolated func hash(into hasher: inout Hasher) { // okay, non-isolated satisfies synchronous requirement
44+
hasher.combine(idNumber) // okay, can reference idNumber from outside the let
45+
hasher.combine(balance) // error: cannot synchronously access actor-isolated property
46+
}
47+
}
48+
```
49+
3250
* Type names are no longer allowed as an argument to a subscript parameter that expects a metatype type
3351

3452
```swift
@@ -8516,6 +8534,7 @@ Swift 1.0
85168534
[SE-0299]: <https://github.com/apple/swift-evolution/blob/main/proposals/0299-extend-generic-static-member-lookup.md>
85178535
[SE-0306]: <https://github.com/apple/swift-evolution/blob/main/proposals/0306-actors.md>
85188536
[SE-0310]: <https://github.com/apple/swift-evolution/blob/main/proposals/0310-effectful-readonly-properties.md>
8537+
[SE-0313]: <https://github.com/apple/swift-evolution/blob/main/proposals/0313-actor-isolation-control.md>
85198538

85208539
[SR-75]: <https://bugs.swift.org/browse/SR-75>
85218540
[SR-106]: <https://bugs.swift.org/browse/SR-106>

include/swift/AST/Attr.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ DECL_ATTR(completionHandlerAsync, CompletionHandlerAsync,
632632

633633
CONTEXTUAL_SIMPLE_DECL_ATTR(nonisolated, Nonisolated,
634634
DeclModifier | OnFunc | OnConstructor | OnVar | OnSubscript |
635-
ConcurrencyOnly |
636635
ABIStableToAdd | ABIStableToRemove |
637636
APIBreakingToAdd | APIStableToRemove,
638637
112)

test/SourceKit/CodeComplete/complete_override.swift.response

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@
214214
key.typerelation: source.codecompletion.typerelation.notapplicable,
215215
key.num_bytes_to_erase: 0
216216
},
217+
{
218+
key.kind: source.lang.swift.keyword,
219+
key.name: "nonisolated",
220+
key.sourcetext: "nonisolated",
221+
key.description: "nonisolated",
222+
key.typename: "",
223+
key.context: source.codecompletion.context.none,
224+
key.typerelation: source.codecompletion.typerelation.notapplicable,
225+
key.num_bytes_to_erase: 0
226+
},
217227
{
218228
key.kind: source.lang.swift.keyword,
219229
key.name: "nonmutating",

test/decl/class/actor/noconcurrency.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)