Skip to content

Commit 3b1ad80

Browse files
authored
Merge pull request #3972 from swiftwasm/main
[pull] swiftwasm from main
2 parents aa7c420 + 2d12fab commit 3b1ad80

Some content is hidden

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

43 files changed

+1899
-700
lines changed

docs/DifferentiableProgramming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ differentiation: given an "original function" to differentiate, a derivative
698698
function is generated by replacing function applications in the original
699699
function with corresponding derivative function applications. The algorithm is
700700
described in detail in the
701-
[Swift Differentiable Programming Implementation Overview document](http://bit.ly/swift-autodiff-internals).
701+
[Swift Differentiable Programming Implementation Overview](DifferentiableProgrammingImplementation.md).
702702

703703
Some languages provide the ability to define custom code transformations:
704704

docs/DifferentiableProgrammingImplementation.md

Lines changed: 1000 additions & 0 deletions
Large diffs are not rendered by default.
66.4 KB
Loading
51.6 KB
Loading

include/swift/AST/ASTContext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,11 @@ class ASTContext final {
12311231
bool isRecursivelyConstructingRequirementMachine(
12321232
CanGenericSignature sig);
12331233

1234+
/// This is a hack to break cycles. Don't introduce new callers of this
1235+
/// method.
1236+
bool isRecursivelyConstructingRequirementMachine(
1237+
const ProtocolDecl *proto);
1238+
12341239
/// Retrieve a generic signature with a single unconstrained type parameter,
12351240
/// like `<T>`.
12361241
CanGenericSignature getSingleGenericParameterSignature() const;

include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(_const, CompileTimeConst,
699699
ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
700700
126)
701701

702-
SIMPLE_DECL_ATTR(_unavailableFromAsync, UnavailableFromAsync,
702+
DECL_ATTR(_unavailableFromAsync, UnavailableFromAsync,
703703
OnFunc | OnConstructor | UserInaccessible |
704704
ABIStableToAdd | ABIStableToRemove |
705705
APIBreakingToAdd | APIStableToRemove,

include/swift/AST/Attr.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,26 @@ class TypeSequenceAttr : public DeclAttribute {
20852085
}
20862086
};
20872087

2088+
/// The @_unavailableFromAsync attribute, used to make function declarations
2089+
/// unavailable from async contexts.
2090+
class UnavailableFromAsyncAttr : public DeclAttribute {
2091+
public:
2092+
UnavailableFromAsyncAttr(StringRef Message, SourceLoc AtLoc,
2093+
SourceRange Range, bool Implicit)
2094+
: DeclAttribute(DAK_UnavailableFromAsync, AtLoc, Range, Implicit),
2095+
Message(Message) {}
2096+
UnavailableFromAsyncAttr(StringRef Message, bool Implicit)
2097+
: UnavailableFromAsyncAttr(Message, SourceLoc(), SourceRange(),
2098+
Implicit) {}
2099+
const StringRef Message;
2100+
2101+
bool hasMessage() const { return !Message.empty(); }
2102+
2103+
static bool classof(const DeclAttribute *DA) {
2104+
return DA->getKind() == DAK_UnavailableFromAsync;
2105+
}
2106+
};
2107+
20882108
/// Attributes that may be applied to declarations.
20892109
class DeclAttributes {
20902110
/// Linked list of declaration attributes.

include/swift/AST/DiagnosticsParse.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,8 @@ ERROR(attr_missing_label,PointsToFirstBadToken,
14351435
"missing label '%0:' in '@%1' attribute", (StringRef, StringRef))
14361436
ERROR(attr_expected_label,none,
14371437
"expected label '%0:' in '@%1' attribute", (StringRef, StringRef))
1438+
ERROR(attr_expected_colon_after_label,none,
1439+
"expected ':' after label '%0'", (StringRef))
14381440

14391441
ERROR(alignment_must_be_positive_integer,none,
14401442
"alignment value must be a positive integer literal", ())

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4719,7 +4719,8 @@ ERROR(async_named_decl_must_be_available_from_async,none,
47194719
"asynchronous %0 %1 must be available from asynchronous contexts",
47204720
(DescriptiveDeclKind, DeclName))
47214721
ERROR(async_unavailable_decl,none,
4722-
"%0 %1 is unavailable from asynchronous contexts", (DescriptiveDeclKind, DeclBaseName))
4722+
"%0 %1 is unavailable from asynchronous contexts%select{|; %3}2",
4723+
(DescriptiveDeclKind, DeclBaseName, bool, StringRef))
47234724

47244725
//------------------------------------------------------------------------------
47254726
// MARK: Type Check Types

lib/AST/ASTContext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,11 @@ bool ASTContext::isRecursivelyConstructingRequirementMachine(
20172017
return getRewriteContext().isRecursivelyConstructingRequirementMachine(sig);
20182018
}
20192019

2020+
bool ASTContext::isRecursivelyConstructingRequirementMachine(
2021+
const ProtocolDecl *proto) {
2022+
return getRewriteContext().isRecursivelyConstructingRequirementMachine(proto);
2023+
}
2024+
20202025
Optional<llvm::TinyPtrVector<ValueDecl *>>
20212026
OverriddenDeclsRequest::getCachedResult() const {
20222027
auto decl = std::get<0>(getStorage());

0 commit comments

Comments
 (0)