Skip to content

Commit 5987654

Browse files
authored
Merge branch 'main' into allowable-serialization
2 parents c3db946 + 527d9a8 commit 5987654

File tree

344 files changed

+1696
-1648
lines changed

Some content is hidden

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

344 files changed

+1696
-1648
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ lib/ClangImporter @zoecarver @hyp @egorzhdan
1919
lib/PrintAsClang @zoecarver @hyp @egorzhdan
2020
stdlib/public/Cxx @zoecarver @hyp @egorzhdan
2121
test/Interop @zoecarver @hyp @egorzhdan
22+
23+
# Windows support
24+
cmake/**/*Windows* @compnerd
25+
lib/Basic/Windows @compnerd
26+
stdlib/public/Windows @compnerd
27+
utils/*windows* @compnerd

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: ''
5-
labels: bug
5+
labels: bug, triage needed
66
assignees: ''
77

88
---

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Share an idea
44
title: ''
5-
labels: feature request
5+
labels: feature request, triage needed
66
assignees: ''
77

88
---

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
44

55
## Swift 5.8
66

7+
* [#56139][]:
8+
9+
Сollection downcasts in cast patterns are now supported. For example:
10+
11+
```swift
12+
func collectionDowncast(_ arr: [Any]) {
13+
switch arr {
14+
case let ints as [Int]:
15+
// ...
16+
case is [Bool]:
17+
// ...
18+
}
19+
}
20+
```
21+
722
* [SE-0365][]:
823

924
Implicit `self` is now permitted for `weak self` captures, after `self` is unwrapped.
@@ -9624,3 +9639,4 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
96249639
[#54246]: <https://github.com/apple/swift/issues/54246>
96259640
[#57081]: <https://github.com/apple/swift/issues/57081>
96269641
[#57225]: <https://github.com/apple/swift/issues/57225>
9642+
[#56139]: <https://github.com/apple/swift/issues/56139>

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ macro(configure_sdk_unix name architectures)
392392

393393
set(SWIFT_SDK_OPENBSD_ARCH_amd64_TRIPLE "amd64-unknown-openbsd${openbsd_system_version}")
394394

395-
if(CMAKE_SYSROOT)
396-
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH "${CMAKE_SYSROOT}${SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH}" CACHE INTERNAL "sysroot path" FORCE)
397-
endif()
395+
if(CMAKE_SYSROOT)
396+
set(SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH "${CMAKE_SYSROOT}${SWIFT_SDK_OPENBSD_ARCH_${arch}_PATH}" CACHE INTERNAL "sysroot path" FORCE)
397+
endif()
398398
elseif("${prefix}" STREQUAL "CYGWIN")
399399
if(NOT arch STREQUAL x86_64)
400400
message(FATAL_ERROR "unsupported arch for cygwin: ${arch}")

docs/ReferenceGuides/UnderscoredAttributes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,15 @@ initializers from its superclass. This implies that all designated initializers
535535
overridden. This attribute is often printed alongside
536536
`@_hasMissingDesignatedInitializers` in this case.
537537

538+
## `@inline(__always)`
539+
540+
Forces the function to be inlined.
541+
542+
If it's not possible to always inline the function, e.g. if it's a self-
543+
recursive function, the attribute is ignored.
544+
545+
This attribute has no effect in debug builds.
546+
538547
## `@_noEagerMove`
539548

540549
When applied to a value, indicates that the value's lifetime is lexical, that

docs/SIL.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,14 +1070,14 @@ The minimal OS-version where the function is available.
10701070
::
10711071

10721072
sil-function-attribute ::= '[' sil-function-inlining ']'
1073-
sil-function-inlining ::= 'never'
1073+
sil-function-inlining ::= 'noinline'
10741074

10751075
The function is never inlined.
10761076
::
10771077

1078-
sil-function-inlining ::= 'always'
1078+
sil-function-inlining ::= 'always_inline'
10791079

1080-
The function is always inlined, even in a ``Onone`` build.
1080+
The function is always inlined.
10811081
::
10821082

10831083
sil-function-attribute ::= '[' sil-function-optimization ']'

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class SDKContext {
212212
DiagnosticEngine &getDiags(SourceLoc Loc = SourceLoc());
213213
void addDiagConsumer(DiagnosticConsumer &Consumer);
214214
void setCommonVersion(uint8_t Ver) {
215-
assert(!CommonVersion.hasValue());
215+
assert(!CommonVersion.has_value());
216216
CommonVersion = Ver;
217217
}
218218
uint8_t getCommonVersion() const {
@@ -401,7 +401,7 @@ class SDKNodeDecl: public SDKNode {
401401
StringRef getGenericSignature() const { return GenericSig; }
402402
StringRef getSugaredGenericSignature() const { return SugaredGenericSig; }
403403
StringRef getScreenInfo() const;
404-
bool hasFixedBinaryOrder() const { return FixedBinaryOrder.hasValue(); }
404+
bool hasFixedBinaryOrder() const { return FixedBinaryOrder.has_value(); }
405405
uint8_t getFixedBinaryOrder() const { return *FixedBinaryOrder; }
406406
PlatformIntroVersion getIntroducingVersion() const { return introVersions; }
407407
StringRef getObjCName() const { return ObjCName; }
@@ -685,9 +685,9 @@ class SDKNodeDeclAbstractFunc : public SDKNodeDecl {
685685
public:
686686
bool isThrowing() const { return IsThrowing; }
687687
bool reqNewWitnessTableEntry() const { return ReqNewWitnessTableEntry; }
688-
uint8_t getSelfIndex() const { return SelfIndex.getValue(); }
688+
uint8_t getSelfIndex() const { return SelfIndex.value(); }
689689
Optional<uint8_t> getSelfIndexOptional() const { return SelfIndex; }
690-
bool hasSelfIndex() const { return SelfIndex.hasValue(); }
690+
bool hasSelfIndex() const { return SelfIndex.has_value(); }
691691
static bool classof(const SDKNode *N);
692692
virtual void jsonize(json::Output &out) override;
693693
static StringRef getTypeRoleDescription(SDKContext &Ctx, unsigned Index);

include/swift/AST/ArgumentList.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class alignas(Argument) ArgumentList final
154154
assert(!firstTrailingClosureIndex || *firstTrailingClosureIndex < numArgs &&
155155
"Invalid trailing closure index");
156156
RawFirstTrailingClosureIndex =
157-
firstTrailingClosureIndex.getValueOr(numArgs);
157+
firstTrailingClosureIndex.value_or(numArgs);
158158
}
159159

160160
ArgumentList(const ArgumentList &) = delete;
@@ -400,7 +400,7 @@ class alignas(Argument) ArgumentList final
400400

401401
/// Whether any unlabeled or labeled trailing closures are present.
402402
bool hasAnyTrailingClosures() const {
403-
return getOriginalArgs()->getFirstTrailingClosureIndex().hasValue();
403+
return getOriginalArgs()->getFirstTrailingClosureIndex().has_value();
404404
}
405405

406406
/// Whether a given index is for an unlabeled trailing closure, which is the
@@ -443,7 +443,7 @@ class alignas(Argument) ArgumentList final
443443
iterator_range<iterator> getNonTrailingArgs() const {
444444
assert(!HasOriginalArgs && "Query original args instead");
445445
auto idx = getFirstTrailingClosureIndex();
446-
if (!idx.hasValue())
446+
if (!idx.has_value())
447447
return *this;
448448

449449
return {begin(), iterator(this, *idx)};
@@ -456,7 +456,7 @@ class alignas(Argument) ArgumentList final
456456
iterator_range<iterator> getTrailingClosures() const {
457457
assert(!HasOriginalArgs && "Query original args instead");
458458
auto idx = getFirstTrailingClosureIndex();
459-
if (!idx.hasValue())
459+
if (!idx.has_value())
460460
return {end(), end()};
461461

462462
return {iterator(this, *idx), end()};
@@ -470,7 +470,7 @@ class alignas(Argument) ArgumentList final
470470
Optional<Argument> getFirstTrailingClosure() const {
471471
assert(!HasOriginalArgs && "Query original args instead");
472472
auto idx = getFirstTrailingClosureIndex();
473-
if (!idx.hasValue())
473+
if (!idx.has_value())
474474
return None;
475475
return get(*idx);
476476
}

include/swift/AST/Attr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,13 +2634,13 @@ class TypeAttributes {
26342634
return true;
26352635
}
26362636

2637-
bool hasConvention() const { return ConventionArguments.hasValue(); }
2637+
bool hasConvention() const { return ConventionArguments.has_value(); }
26382638

26392639
/// Returns the primary calling convention string.
26402640
///
26412641
/// Note: For C conventions, this may not represent the full convention.
26422642
StringRef getConventionName() const {
2643-
return ConventionArguments.getValue().Name;
2643+
return ConventionArguments.value().Name;
26442644
}
26452645

26462646
/// Show the string enclosed between @convention(..)'s parentheses.
@@ -2664,10 +2664,10 @@ class TypeAttributes {
26642664
#include "swift/AST/ReferenceStorage.def"
26652665
}
26662666

2667-
bool hasOpenedID() const { return OpenedID.hasValue(); }
2667+
bool hasOpenedID() const { return OpenedID.has_value(); }
26682668
UUID getOpenedID() const { return *OpenedID; }
26692669

2670-
bool hasConstraintType() const { return ConstraintType.hasValue(); }
2670+
bool hasConstraintType() const { return ConstraintType.has_value(); }
26712671
TypeRepr *getConstraintType() const { return *ConstraintType; }
26722672

26732673
/// Given a name like "autoclosure", return the type attribute ID that

0 commit comments

Comments
 (0)