Skip to content

Commit b8f4935

Browse files
committed
Track 'release/5.5' to resolve merge conflicts.
Conflicts in stdlib/public/Concurrency/TaskGroup.swift from async/spawn renaming. Resolved by copying the docs to the new symbols from their old names.
2 parents 112acee + 9fc3e6a commit b8f4935

File tree

115 files changed

+3442
-782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3442
-782
lines changed

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ CHANGELOG
2929
Swift 5.5
3030
---------
3131

32+
* Type names are no longer allowed as an argument to a subscript parameter that expects a metatype type
33+
34+
```swift
35+
struct MyValue {
36+
}
37+
38+
struct MyStruct {
39+
subscript(a: MyValue.Type) -> Int { get { ... } }
40+
}
41+
42+
func test(obj: MyStruct) {
43+
let _ = obj[MyValue]
44+
}
45+
```
46+
47+
Accepting subscripts with `MyValue` as an argument was an oversight because `MyValue` requires explicit `.self`
48+
to reference its metatype, so correct syntax would be to use `obj[MyValue.self]`.
49+
3250
* [SE-0310][]:
3351

3452
Read-only computed properties and subscripts can now define their `get` accessor to be `async` and/or `throws`, by writing one or both of those keywords between the `get` and `{`. Thus, these members can now make asynchronous calls or throw errors in the process of producing a value:
@@ -72,7 +90,6 @@ Swift 5.5
7290
}
7391
```
7492

75-
7693
* [SE-0306][]:
7794

7895
Swift 5.5 includes support for actors, a new kind of type that isolates its instance data to protect it from concurrent access. Accesses to an actor's instance declarations from outside the must be asynchronous:

include/swift/ABI/MetadataValues.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,8 @@ enum class JobKind : size_t {
19771977

19781978
DefaultActorInline = First_Reserved,
19791979
DefaultActorSeparate,
1980-
DefaultActorOverride
1980+
DefaultActorOverride,
1981+
NullaryContinuation
19811982
};
19821983

19831984
/// The priority of a job. Higher priorities are larger values.

include/swift/ABI/Task.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,25 @@ class ActiveTaskStatus {
155155
}
156156
};
157157

158+
class NullaryContinuationJob : public Job {
159+
160+
private:
161+
AsyncTask* Task;
162+
AsyncTask* Continuation;
163+
164+
public:
165+
NullaryContinuationJob(AsyncTask *task, JobPriority priority, AsyncTask *continuation)
166+
: Job({JobKind::NullaryContinuation, priority}, &process),
167+
Task(task), Continuation(continuation) {}
168+
169+
SWIFT_CC(swiftasync)
170+
static void process(Job *job);
171+
172+
static bool classof(const Job *job) {
173+
return job->Flags.getKind() == JobKind::NullaryContinuation;
174+
}
175+
};
176+
158177
/// An asynchronous task. Tasks are the analogue of threads for
159178
/// asynchronous functions: that is, they are a persistent identity
160179
/// for the overall async computation.
@@ -562,6 +581,10 @@ class ContinuationAsyncContext : public AsyncContext {
562581
/// The executor that should be resumed to.
563582
ExecutorRef ResumeToExecutor;
564583

584+
void setErrorResult(SwiftError *error) {
585+
ErrorResult = error;
586+
}
587+
565588
static bool classof(const AsyncContext *context) {
566589
return context->Flags.getKind() == AsyncContextKind::Continuation;
567590
}

include/swift/AST/Decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ class PatternBindingDecl final : public Decl,
18621862
bool isComputingPatternBindingEntry(const VarDecl *vd) const;
18631863

18641864
/// Is this an "async let" declaration?
1865-
bool isSpawnLet() const;
1865+
bool isAsyncLet() const;
18661866

18671867
/// Gets the text of the initializer expression for the pattern entry at the
18681868
/// given index, stripping out inactive branches of any #ifs inside the
@@ -4942,7 +4942,7 @@ class VarDecl : public AbstractStorageDecl {
49424942
bool isLet() const { return getIntroducer() == Introducer::Let; }
49434943

49444944
/// Is this an "async let" property?
4945-
bool isSpawnLet() const;
4945+
bool isAsyncLet() const;
49464946

49474947
Introducer getIntroducer() const {
49484948
return Introducer(Bits.VarDecl.Introducer);

include/swift/AST/DiagnosticsSema.def

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ ERROR(cannot_convert_argument_value_anyobject,none,
425425
(Type, Type))
426426
ERROR(cannot_convert_argument_value_nil,none,
427427
"'nil' is not compatible with expected argument type %0", (Type))
428+
NOTE(note_incompatible_argument_value_nil_at_pos,none,
429+
"'nil' is not compatible with expected argument type %0 at position #%1",
430+
(Type, unsigned))
428431

429432
ERROR(cannot_convert_condition_value,none,
430433
"cannot convert value of type %0 to expected condition type %1",
@@ -806,6 +809,8 @@ ERROR(serialization_error_type,Fatal,
806809
ERROR(serialization_allowing_error_type,none,
807810
"allowing deserialization of error type '%0' in module '%1'",
808811
(StringRef, StringRef))
812+
WARNING(serialization_malformed_sourceinfo,none,
813+
"unable to use malformed module source info '%0'", (StringRef))
809814

810815
ERROR(reserved_member_name,none,
811816
"type member must not be named %0, since it would conflict with the"
@@ -4238,8 +4243,8 @@ ERROR(throwing_interpolation_without_try,none,
42384243
"interpolation can throw but is not marked with 'try'", ())
42394244
ERROR(throwing_call_without_try,none,
42404245
"call can throw but is not marked with 'try'", ())
4241-
ERROR(throwing_spawn_let_without_try,none,
4242-
"reading 'spawn let' can throw but is not marked with 'try'", ())
4246+
ERROR(throwing_async_let_without_try,none,
4247+
"reading 'async let' can throw but is not marked with 'try'", ())
42434248
ERROR(throwing_prop_access_without_try,none,
42444249
"property access can throw but is not marked with 'try'", ())
42454250
ERROR(throwing_subscript_access_without_try,none,
@@ -4268,8 +4273,8 @@ NOTE(async_access_without_await,none,
42684273

42694274
NOTE(async_call_without_await_in_autoclosure,none,
42704275
"call is 'async' in an autoclosure argument", ())
4271-
NOTE(async_call_without_await_in_spawn_let,none,
4272-
"call is 'async' in an 'spawn let' initializer", ())
4276+
NOTE(async_call_without_await_in_async_let,none,
4277+
"call is 'async' in an 'async let' initializer", ())
42734278

42744279
WARNING(no_async_in_await,none,
42754280
"no 'async' operations occur within 'await' expression", ())
@@ -4282,7 +4287,7 @@ ERROR(await_in_illegal_context,none,
42824287
"%select{<<ERROR>>|a default argument|a property wrapper initializer|a property initializer|a global variable initializer|an enum case raw value|a catch pattern|a catch guard expression|a defer body}0",
42834288
(unsigned))
42844289
ERROR(async_in_nonasync_function,none,
4285-
"%select{'async'|'async' call|'await'|'spawn let'|'async' property access|'async' subscript access}0 in "
4290+
"%select{'async'|'async' call|'await'|'async let'|'async' property access|'async' subscript access}0 in "
42864291
"%select{a function|an autoclosure}1 that does not support concurrency",
42874292
(unsigned, bool))
42884293
NOTE(note_add_async_to_function,none,
@@ -4309,21 +4314,18 @@ NOTE(protocol_witness_async_conflict,none,
43094314
ERROR(async_autoclosure_nonasync_function,none,
43104315
"'async' autoclosure parameter in a non-'async' function", ())
43114316

4312-
WARNING(async_let_is_spawn_let,none,
4313-
"'async let' is now 'spawn let'", ())
4314-
4315-
ERROR(spawn_not_let,none,
4316-
"'spawn' can only be used with 'let' declarations", ())
4317-
ERROR(spawn_let_not_local,none,
4318-
"'spawn let' can only be used on local declarations", ())
4319-
ERROR(spawn_let_not_initialized,none,
4320-
"'spawn let' binding requires an initializer expression", ())
4321-
ERROR(spawn_let_no_variables,none,
4322-
"'spawn let' requires at least one named variable", ())
4323-
NOTE(spawn_let_without_await,none,
4324-
"reference to spawn let %0 is 'async'", (DeclName))
4325-
ERROR(spawn_let_in_illegal_context,none,
4326-
"spawn let %0 cannot be referenced in "
4317+
ERROR(async_not_let,none,
4318+
"'async' can only be used with 'let' declarations", ())
4319+
ERROR(async_let_not_local,none,
4320+
"'async let' can only be used on local declarations", ())
4321+
ERROR(async_let_not_initialized,none,
4322+
"'async let' binding requires an initializer expression", ())
4323+
ERROR(async_let_no_variables,none,
4324+
"'async let' requires at least one named variable", ())
4325+
NOTE(async_let_without_await,none,
4326+
"reference to async let %0 is 'async'", (DeclName))
4327+
ERROR(async_let_in_illegal_context,none,
4328+
"async let %0 cannot be referenced in "
43274329
"%select{<<ERROR>>|a default argument|a property wrapper initializer|a property initializer|a global variable initializer|an enum case raw value|a catch pattern|a catch guard expression|a defer body}1",
43284330
(DeclName, unsigned))
43294331

@@ -4413,8 +4415,8 @@ ERROR(actor_isolated_from_concurrent_closure,none,
44134415
ERROR(actor_isolated_from_concurrent_function,none,
44144416
"actor-isolated %0 %1 cannot be %select{referenced|mutated|used 'inout'}2 from a concurrent function",
44154417
(DescriptiveDeclKind, DeclName, unsigned))
4416-
ERROR(actor_isolated_from_spawn_let,none,
4417-
"actor-isolated %0 %1 cannot be %select{referenced|mutated|used 'inout'}2 from 'spawn let' initializer",
4418+
ERROR(actor_isolated_from_async_let,none,
4419+
"actor-isolated %0 %1 cannot be %select{referenced|mutated|used 'inout'}2 from 'async let' initializer",
44184420
(DescriptiveDeclKind, DeclName, unsigned))
44194421
ERROR(actor_isolated_keypath_component,none,
44204422
"cannot form key path to actor-isolated %0 %1",
@@ -4436,9 +4438,6 @@ NOTE(actor_isolated_sync_func,none,
44364438
NOTE(actor_mutable_state,none,
44374439
"mutation of this %0 is only permitted within the actor",
44384440
(DescriptiveDeclKind))
4439-
NOTE(actor_isolated_let,none,
4440-
"use `nonisolated` to allow synchronous access to 'let' from outside "
4441-
"the actor", ())
44424441
WARNING(shared_mutable_state_access,none,
44434442
"reference to %0 %1 is not concurrency-safe because it involves "
44444443
"shared mutable state", (DescriptiveDeclKind, DeclName))
@@ -4471,12 +4470,13 @@ WARNING(non_concurrent_property_type,none,
44714470
WARNING(non_concurrent_keypath_capture,none,
44724471
"cannot form key path that captures non-sendable type %0",
44734472
(Type))
4473+
WARNING(non_concurrent_keypath_access,none,
4474+
"cannot form key path that accesses non-sendable type %0",
4475+
(Type))
44744476
ERROR(non_concurrent_type_member,none,
44754477
"%select{stored property %1|associated value %1}0 of "
44764478
"'Sendable'-conforming %2 %3 has non-sendable type %4",
44774479
(bool, DeclName, DescriptiveDeclKind, DeclName, Type))
4478-
ERROR(non_sendable_nonisolated_let,none,
4479-
"non-isolated let property %0 has non-Sendable type %1", (DeclName, Type))
44804480
ERROR(concurrent_value_class_mutable_property,none,
44814481
"stored property %0 of 'Sendable'-conforming %1 %2 is mutable",
44824482
(DeclName, DescriptiveDeclKind, DeclName))
@@ -4492,13 +4492,21 @@ ERROR(concurrent_value_inherit,none,
44924492
"%select{| other than 'NSObject'}0",
44934493
(bool, DeclName))
44944494

4495+
ERROR(actorindependent_let,none,
4496+
"'@actorIndependent' is meaningless on 'let' declarations because "
4497+
"they are immutable",
4498+
())
44954499
ERROR(actorindependent_mutable_storage,none,
44964500
"'@actorIndependent' can not be applied to stored properties",
44974501
())
44984502
ERROR(actorindependent_local_var,none,
44994503
"'@actorIndependent' can not be applied to local variables",
45004504
())
45014505

4506+
ERROR(nonisolated_let,none,
4507+
"'nonisolated' is meaningless on 'let' declarations because "
4508+
"they are immutable",
4509+
())
45024510
ERROR(nonisolated_mutable_storage,none,
45034511
"nonisolated' can not be applied to stored properties",
45044512
())

include/swift/AST/NameLookup.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,7 @@ class FindLocalVal : public StmtVisitor<FindLocalVal> {
555555
VisibleDeclConsumer &Consumer)
556556
: SM(SM), Loc(Loc), Consumer(Consumer) {}
557557

558-
void checkValueDecl(ValueDecl *D, DeclVisibilityKind Reason) {
559-
Consumer.foundDecl(D, Reason);
560-
}
558+
void checkValueDecl(ValueDecl *D, DeclVisibilityKind Reason);
561559

562560
void checkPattern(const Pattern *Pat, DeclVisibilityKind Reason);
563561

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ LANGUAGE_FEATURE(BuiltinExecutor, 0, "Executor builtins", true)
4848
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
4949
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
5050
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
51+
LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true)
5152

5253
#undef LANGUAGE_FEATURE

include/swift/Frontend/FrontendOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ class FrontendOptions {
394394
///
395395
/// \sa SymbolGraphASTWalker
396396
std::string SymbolGraphOutputDir;
397+
398+
/// Whether to emit doc comment information in symbol graphs for symbols
399+
/// which are inherited through classes or default implementations.
400+
bool SkipInheritedDocs = false;
397401

398402
private:
399403
static bool canActionEmitDependencies(ActionType);

include/swift/IDE/CodeCompletion.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ enum class CompletionKind {
561561
GenericRequirement,
562562
PrecedenceGroup,
563563
StmtLabel,
564+
ForEachPatternBeginning,
564565
};
565566

566567
/// A single code completion result.
@@ -866,6 +867,9 @@ struct CodeCompletionResultSink {
866867
/// Whether to annotate the results with XML.
867868
bool annotateResult = false;
868869

870+
/// Whether to emit object literals if desired.
871+
bool includeObjectLiterals = true;
872+
869873
std::vector<CodeCompletionResult *> Results;
870874

871875
/// A single-element cache for module names stored in Allocator, keyed by a
@@ -937,6 +941,11 @@ class CodeCompletionContext {
937941
void setAnnotateResult(bool flag) { CurrentResults.annotateResult = flag; }
938942
bool getAnnotateResult() { return CurrentResults.annotateResult; }
939943

944+
void setIncludeObjectLiterals(bool flag) {
945+
CurrentResults.includeObjectLiterals = flag;
946+
}
947+
bool includeObjectLiterals() { return CurrentResults.includeObjectLiterals; }
948+
940949
/// Allocate a string owned by the code completion context.
941950
StringRef copyString(StringRef Str);
942951

include/swift/Option/Options.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,4 +1224,10 @@ def minimum_access_level : Separate<["-"], "minimum-access-level">,
12241224
HelpText<"Include symbols with this access level or more">,
12251225
MetaVarName<"<level>">;
12261226

1227+
def skip_inherited_docs : Flag<["-"], "skip-inherited-docs">,
1228+
Flags<[SwiftSymbolGraphExtractOption, FrontendOption,
1229+
NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
1230+
HelpText<"Skip emitting doc comments for members inherited through classes or "
1231+
"default implementations">;
1232+
12271233
include "FrontendOptions.td"

0 commit comments

Comments
 (0)