Skip to content

Commit 29ce7f3

Browse files
committed
Fix merge issues and @differentiable attribute type-checking.
- Fix `resolveDifferentiableAttrDerivativeGenericSignature`. - Generic signature should be returned directly instead of retrieved from generic environment. - Delete `DifferentiableAttributeParameterIndicesRequest`. - That request was upstreamed and renamed to `DifferentiableAttributeTypeCheckRequest`. Stdlib compilation (`TensorFlow` module) fixed.
1 parent 457df8f commit 29ce7f3

File tree

5 files changed

+5
-430
lines changed

5 files changed

+5
-430
lines changed

include/swift/AST/Attr.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,10 +1702,6 @@ class DifferentiableAttr final
17021702
friend TrailingObjects;
17031703
friend class DifferentiableAttributeTypeCheckRequest;
17041704

1705-
// SWIFT_ENABLE_TENSORFLOW
1706-
friend class DifferentiableAttributeParameterIndicesRequest;
1707-
// SWIFT_ENABLE_TENSORFLOW END
1708-
17091705
/// The declaration on which the `@differentiable` attribute is declared.
17101706
/// May not be a valid declaration for `@differentiable` attributes.
17111707
/// Resolved during parsing and deserialization.

include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,30 +1660,6 @@ class CompareDeclSpecializationRequest
16601660
bool isCached() const { return true; }
16611661
};
16621662

1663-
// SWIFT_ENABLE_TENSORFLOW
1664-
class DifferentiableAttributeParameterIndicesRequest :
1665-
public SimpleRequest<DifferentiableAttributeParameterIndicesRequest,
1666-
IndexSubset *(DifferentiableAttr *, Decl *),
1667-
CacheKind::SeparatelyCached> {
1668-
public:
1669-
using SimpleRequest::SimpleRequest;
1670-
1671-
private:
1672-
friend SimpleRequest;
1673-
1674-
// Evaluation.
1675-
llvm::Expected<IndexSubset *>
1676-
evaluate(Evaluator &evaluator, DifferentiableAttr *attr, Decl *decl) const;
1677-
1678-
public:
1679-
// Separate caching.
1680-
bool isCached() const { return true; }
1681-
Optional<IndexSubset *> getCachedResult() const;
1682-
void cacheResult(IndexSubset *value) const;
1683-
};
1684-
// SWIFT_ENABLE_TENSORFLOW END
1685-
1686-
16871663
/// Checks whether this declaration inherits its superclass' designated and
16881664
/// convenience initializers.
16891665
class InheritsSuperclassInitializersRequest

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ SWIFT_REQUEST(TypeChecker, DefaultArgumentInitContextRequest,
4040
Initializer *(ParamDecl *), SeparatelyCached, NoLocationInfo)
4141
SWIFT_REQUEST(TypeChecker, DefaultDefinitionTypeRequest,
4242
Type(AssociatedTypeDecl *), Cached, NoLocationInfo)
43-
// SWIFT_ENABLE_TENSORFLOW
44-
SWIFT_REQUEST(TypeChecker, DifferentiableAttributeParameterIndicesRequest,
45-
IndexSubset *(DifferentiableAttr *, Decl *),
46-
SeparatelyCached, NoLocationInfo)
47-
// SWIFT_ENABLE_TENSORFLOW END
4843
SWIFT_REQUEST(TypeChecker, DefaultTypeRequest,
4944
Type(KnownProtocolKind, const DeclContext *), SeparatelyCached,
5045
NoLocationInfo)

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,24 +1055,6 @@ void swift::simple_display(llvm::raw_ostream &out,
10551055
desc.nameLoc.print(out, desc.dc->getASTContext().SourceMgr);
10561056
}
10571057

1058-
//----------------------------------------------------------------------------//
1059-
// DifferentiableAttributeParameterIndicesRequest computation.
1060-
//----------------------------------------------------------------------------//
1061-
1062-
Optional<IndexSubset *>
1063-
DifferentiableAttributeParameterIndicesRequest::getCachedResult() const {
1064-
auto *attr = std::get<0>(getStorage());
1065-
if (attr->hasBeenTypeChecked())
1066-
return attr->ParameterIndicesAndBit.getPointer();
1067-
return None;
1068-
}
1069-
1070-
void DifferentiableAttributeParameterIndicesRequest::cacheResult(
1071-
IndexSubset *parameterIndices) const {
1072-
auto *attr = std::get<0>(getStorage());
1073-
attr->ParameterIndicesAndBit.setPointerAndInt(parameterIndices, true);
1074-
}
1075-
10761058
//----------------------------------------------------------------------------//
10771059
// InheritsSuperclassInitializersRequest computation.
10781060
//----------------------------------------------------------------------------//

0 commit comments

Comments
 (0)